/* path: assets/css/app.css */

:root {
    --color-page: #f4f6f9;
    --color-surface: #ffffff;
    --color-surface-muted: #f8fafc;
    --color-border: #d9e0ea;
    --color-text: #172033;
    --color-muted: #667085;
    --color-primary: #14532d;
    --color-primary-strong: #0f3f24;
    --color-accent: #0f766e;
    --color-warning-bg: #fff7ed;
    --color-warning-border: #fed7aa;
    --color-warning-text: #9a3412;
    --color-success-bg: #ecfdf3;
    --color-success-border: #abefc6;
    --color-success-text: #067647;
    --shadow-soft: 0 18px 44px rgba(23, 32, 51, 0.08);
    --sidebar-width: 280px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    background: var(--color-page);
    color: var(--color-text);
    font-family: Anuphan, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
    margin: 0;
    min-height: 100vh;
}

a {
    color: var(--color-accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
.button-link {
    align-items: center;
    background: var(--color-primary);
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
}

button:hover,
.button-link:hover {
    background: var(--color-primary-strong);
    text-decoration: none;
}

input,
select,
textarea {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    min-height: 42px;
    padding: 10px 12px;
    width: 100%;
}

textarea {
    resize: vertical;
}

table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--color-border);
    padding: 13px 14px;
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--color-surface-muted);
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}

td {
    color: #263248;
    font-size: 14px;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    background: #111827;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    align-items: center;
    color: #ffffff;
    display: grid;
    gap: 12px;
    grid-template-columns: 48px minmax(0, 1fr);
    min-height: 56px;
}

.brand:hover {
    text-decoration: none;
}

.brand img {
    background: #ffffff;
    border-radius: 8px;
    height: 48px;
    object-fit: contain;
    padding: 6px;
    width: 48px;
}

.brand span {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.app-sidebar nav {
    display: grid;
    gap: 6px;
}

.app-sidebar nav a {
    border-radius: 8px;
    color: #cbd5e1;
    font-weight: 600;
    padding: 11px 12px;
}

.app-sidebar nav a:hover,
.app-sidebar nav a.is-active {
    background: #1f2937;
    color: #ffffff;
    text-decoration: none;
}

.app-main {
    min-width: 0;
}

.app-topbar {
    align-items: center;
    background: rgba(244, 246, 249, 0.94);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    gap: 20px;
    justify-content: space-between;
    padding: 22px 28px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.app-topbar h1 {
    font-size: 28px;
    line-height: 1.2;
    margin: 2px 0 0;
}

.eyebrow {
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0;
}

.topbar-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.topbar-actions form {
    margin: 0;
}

.language-switcher {
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    display: inline-flex;
    overflow: hidden;
}

.language-switcher a {
    color: #344054;
    font-weight: 700;
    padding: 8px 10px;
}

.language-switcher a.is-active {
    background: #e6f4ef;
    color: var(--color-primary);
}

.page-content {
    display: grid;
    gap: 22px;
    padding: 28px;
}

.notice {
    border-radius: 8px;
    font-weight: 600;
    padding: 14px 16px;
}

.notice-warning {
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    color: var(--color-warning-text);
}

.notice-success {
    background: var(--color-success-bg);
    border: 1px solid var(--color-success-border);
    color: var(--color-success-text);
}

.form-card,
.table-card {
    animation: dashboardEnter 0.5s ease both;
    animation-delay: var(--animation-delay, 0s);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.form-card {
    padding: 22px;
}

.form-card form {
    display: grid;
    gap: 12px;
    max-width: 680px;
}

.form-card label {
    color: #344054;
    font-weight: 700;
    margin-top: 4px;
}

.form-card button {
    justify-self: start;
    margin-top: 8px;
}

.file-name-preview {
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 700;
    margin: -4px 0 4px;
}

.upload-progress {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.upload-progress[hidden] {
    display: none;
}

.upload-progress__header {
    align-items: center;
    color: #344054;
    display: flex;
    font-size: 13px;
    font-weight: 700;
    gap: 12px;
    justify-content: space-between;
}

.upload-progress__track {
    background: var(--color-surface-muted);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    height: 12px;
    overflow: hidden;
}

.upload-progress__track span {
    background: var(--color-accent);
    display: block;
    height: 100%;
    transition: width 0.2s ease;
}

.upload-progress--indeterminate .upload-progress__track span {
    animation: progressIndeterminate 1.2s ease-in-out infinite;
    width: 42%;
}

.table-card {
    overflow-x: auto;
}

.filter-card {
    animation: dashboardEnter 0.5s ease both;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    padding: 16px;
}

.filter-card form {
    align-items: end;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(220px, 1fr) auto minmax(360px, auto);
}

.filter-card__summary {
    display: grid;
    gap: 4px;
}

.filter-card__summary span,
.filter-card__custom label {
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 700;
}

.filter-card__summary strong {
    color: var(--color-text);
    font-size: 15px;
}

.filter-card__presets,
.filter-card__custom {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-card__custom {
    display: grid;
    grid-template-columns: auto minmax(140px, 1fr) auto minmax(140px, 1fr) auto;
}

.filter-card button.is-active {
    background: var(--color-accent);
}

.filter-card input[type="date"] {
    min-width: 140px;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.inline-form button {
    min-height: 36px;
    padding: 8px 12px;
    white-space: nowrap;
}

.cookie-banner {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    bottom: 18px;
    box-shadow: var(--shadow-soft);
    display: flex;
    gap: 18px;
    justify-content: space-between;
    left: 18px;
    max-width: 720px;
    padding: 16px;
    position: fixed;
    right: 18px;
    z-index: 20;
}

.cookie-banner p {
    color: var(--color-muted);
    margin: 4px 0 0;
}

.cookie-banner__actions {
    display: flex;
    flex-shrink: 0;
    gap: 10px;
}

.auth-page {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-panel,
.logout-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    max-width: 420px;
    padding: 32px;
    width: 100%;
}

.login-logo {
    display: block;
    height: 56px;
    margin-bottom: 24px;
    object-fit: contain;
    width: auto;
}

.login-panel h1,
.logout-panel h1 {
    font-size: 24px;
    margin: 0 0 6px;
}

.login-panel p,
.logout-panel p {
    color: var(--color-muted);
    margin: 0 0 24px;
}

.login-panel label {
    display: block;
    font-weight: 700;
    margin: 16px 0 8px;
}

.login-panel button,
.logout-panel button {
    margin-top: 22px;
    width: 100%;
}

.message {
    background: #fff1f3;
    border: 1px solid #ffccd5;
    border-radius: 8px;
    color: #b42318;
    margin-bottom: 18px;
    padding: 12px;
}

@keyframes dashboardEnter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes progressIndeterminate {
    from {
        transform: translateX(-110%);
    }

    to {
        transform: translateX(250%);
    }
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        height: auto;
        position: static;
    }

    .app-sidebar nav {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .app-topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 20px;
    }

    .topbar-actions {
        justify-content: flex-start;
    }

    .page-content {
        padding: 20px;
    }

    .filter-card form {
        align-items: stretch;
        grid-template-columns: 1fr;
    }

    .filter-card__custom {
        grid-template-columns: 1fr 1fr;
    }

    .filter-card__custom button {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .brand {
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .brand img {
        height: 40px;
        width: 40px;
    }

    .app-topbar h1 {
        font-size: 23px;
    }

    .cookie-banner {
        align-items: stretch;
        flex-direction: column;
    }

    .cookie-banner__actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .filter-card__presets,
    .filter-card__custom {
        display: grid;
        grid-template-columns: 1fr;
    }

    .filter-card__custom button {
        grid-column: auto;
    }
}
