/* ===== DESIGN TOKENS ===== */
:root {
    --bg: #ffffff;
    --fg: #111111;
    --bg-secondary: #f5f5f5;
    --border: #dddddd;
    --accent: #333333;
    --accent-fg: #ffffff;
    --success: #2d8a4e;
    --error: #c0392b;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --transition: 0.2s ease;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--fg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ===== LAYOUT ===== */
#app {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px 80px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
header h1 { font-size: 1.1rem; font-weight: 700; }
#user-info { font-size: 0.85rem; color: var(--accent); }

/* ===== NAV ===== */
#main-nav {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.nav-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--fg);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.nav-btn.active {
    background: var(--fg);
    color: var(--bg);
}

/* ===== SECTIONS ===== */

.section h2 {
    font-weight: 700;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* ===== FORMS ===== */
label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 12px 0 4px;
}
input[type="text"],
input[type="time"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    background: var(--bg);
    color: var(--fg);
    transition: border-color var(--transition);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--fg);
}
textarea { resize: vertical; min-height: 80px; }

.time-row {
    display: flex;
    gap: 12px;
}
.time-row > div { flex: 1; }

fieldset.date-choice {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-top: 12px;
}
fieldset.date-choice legend {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0 4px;
}
fieldset.date-choice label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 16px;
    font-weight: 400;
    cursor: pointer;
}

button[type="submit"], .action-btn, #filter-btn, #media-filter-btn, {
    display: inline-block;
    margin-top: 16px;
    padding: 12px 20px;
    background: var(--fg);
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition);
    width: 100%;
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
button:hover:not(:disabled) {
    opacity: 0.85;
}

/* ===== PROGRESS BAR ===== */
#upload-progress-wrap {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
#upload-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}
#upload-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--fg);
    border-radius: 4px;
    transition: width 0.3s ease;
}
#upload-progress-text {
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 36px;
}

/* ===== TOAST ===== */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-fg);
    background: var(--fg);
    box-shadow: var(--shadow);
    animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
    pointer-events: auto;
}
.toast.error { background: var(--error); }
.toast.success { background: var(--success); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}

/* ===== TABLES ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.data-table th, .data-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table th {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
}
.data-table .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.data-table .actions button {
    margin: 0;
    padding: 6px 10px;
    font-size: 0.75rem;
    width: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: black;
}

/* ===== LOGS LIST ===== */
.logs-list { display: flex; flex-direction: column; gap: 8px; }
.log-entry {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-secondary);
}
.log-entry .log-meta {
    font-size: 0.8rem;
    color: var(--accent);
    margin-bottom: 4px;
}
.log-entry .log-task { font-size: 0.9rem; }
.empty-msg { font-size: 0.85rem; color: #999; font-style: italic; }

/* ===== FILTER ===== */
.filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-row label {
    flex: 1;
    min-width: 120px;
    margin: 0;
}
.filter-row select { margin-top: 4px; }


/* ===== MEDIA GRID ===== */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.media-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    aspect-ratio: 1;
}
.media-item img, .media-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.media-item .download-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: var(--fg);
    color: var(--bg);
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.7rem;
    cursor: pointer;
    margin: 0;
    width: auto;
}

/* ===== LOADING ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--fg);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .data-table { font-size: 0.78rem; }
    .data-table th, .data-table td { padding: 8px 4px; }
    /*.filter-row { flex-direction: column; }*/
    .filter-row button { width: 100%; }
    header h1 { font-size: 0.95rem; }
}

/* ===== INLINE EDIT ===== */
.inline-edit {
    display: flex;
    gap: 4px;
    align-items: center;
}
.inline-edit input {
    width: auto;
    flex: 1;
    padding: 4px 8px;
    font-size: 0.85rem;
}
.inline-edit button {
    margin: 0;
    padding: 4px 10px;
    font-size: 0.75rem;
    width: auto;
}

/* Confirm dialog */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}
.confirm-box {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    text-align: center;
}
.confirm-box p { margin-bottom: 16px; font-size: 0.9rem; }
.confirm-box .confirm-actions { display: flex; gap: 8px; }
.confirm-box .confirm-actions button { flex: 1; margin: 0; }

.box {
  background-color: white;
  width: 100%;
  max-width: 900px;
  margin: 40px auto;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0px 5px 20px rgba(0,0,0,0.1);
}
* {
  box-sizing: border-box;
}
input, select {
  -webkit-appearance: none;
  color: rgb(50,50,50);
  padding: 8px;
  font-size: 14px;
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 5px;
}
.submit_btn {
  margin-top: 8px;
  width: 100%;
  padding: 12px;
  font-size: 18px;
  border: 1px solid rgb(50,50,50);
  border-radius: 5px;
  background-color: rgb(50,50,50);
  color: white;
  cursor: pointer;
  transition: 0.2s;
}
.submit_btn:hover {
	color:rgb(50,50,50);
	border: 1px solid #ccc;
	background-color: white;
}
