@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    --admin-bg: #f2f5f2;
    --admin-panel: #ffffff;
    --admin-ink: #1a2330;
    --admin-muted: #5a6472;
    --admin-line: #dde5db;
    --admin-green: #1a7a4a;
    --admin-green-dark: #0e3d28;
    --admin-dark: #0e2519;
    --admin-amber: #e09c28;
    --admin-red: #c0392b;
    --radius: 10px;
    --radius-sm: 6px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 2px 8px rgba(14, 61, 40, 0.07);
    --shadow: 0 8px 28px rgba(14, 61, 40, 0.12);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--admin-bg);
    color: var(--admin-ink);
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

p { margin: 0 0 0.75em; }

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 0.5em;
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-weight: 800;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background: linear-gradient(135deg, var(--admin-dark) 0%, #183d28 100%);
}

.login-card {
    width: min(440px, 100%);
    padding: 36px;
    border-radius: var(--radius);
    background: white;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.login-card h2 {
    color: var(--admin-green-dark);
    font-size: 26px;
    margin-bottom: 6px;
}

.login-card .muted {
    margin-bottom: 28px;
}

/* ============================================================
   ADMIN SHELL LAYOUT
   ============================================================ */
.admin-shell {
    display: grid;
    grid-template-columns: 268px minmax(0, 1fr);
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    background: var(--admin-dark);
    color: rgba(255, 255, 255, 0.82);
    padding: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 4px;
}

.sidebar-brand {
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 10px;
}

.sidebar h1 {
    margin: 0;
    color: white;
    font-size: 17px;
    line-height: 1.25;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.sidebar small {
    display: block;
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.side-nav {
    display: grid;
    gap: 2px;
    padding: 0 12px 24px;
}

.side-nav a,
.side-nav span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.72);
    transition: background var(--transition), color var(--transition);
}

.side-nav a:hover {
    background: rgba(255, 255, 255, 0.09);
    color: white;
}

.side-nav a.is-active {
    background: rgba(26, 122, 74, 0.35);
    color: #7ee8ab;
    font-weight: 600;
}

.side-nav span {
    margin-top: 16px;
    color: var(--admin-amber);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    min-height: 0;
    padding: 4px 12px;
    cursor: default;
}

/* ============================================================
   ADMIN MAIN
   ============================================================ */
.admin-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 70px;
    padding: 0 28px;
    background: white;
    border-bottom: 1px solid var(--admin-line);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.admin-top strong {
    color: var(--admin-dark);
    font-size: 15px;
    font-weight: 700;
}

.admin-content {
    padding: 28px 32px;
    flex: 1;
}

.page-title {
    margin: 0;
    color: var(--admin-dark);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.muted {
    color: var(--admin-muted);
    font-size: 14px;
}

/* ============================================================
   GRID
   ============================================================ */
.grid {
    display: grid;
    gap: 20px;
}

.grid.four {
    grid-template-columns: repeat(4, 1fr);
}

.grid.three {
    grid-template-columns: repeat(3, 1fr);
}

.grid.two {
    grid-template-columns: repeat(2, 1fr);
}

/* ============================================================
   PANELS & METRICS
   ============================================================ */
.panel {
    padding: 22px;
    border: 1px solid var(--admin-line);
    border-radius: var(--radius);
    background: var(--admin-panel);
    box-shadow: var(--shadow-sm);
}

.metric {
    text-align: center;
    transition: transform var(--transition), box-shadow var(--transition);
}

.metric:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.metric strong {
    display: block;
    color: var(--admin-green);
    font-size: 36px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.04em;
}

.metric span {
    display: block;
    margin-top: 6px;
    color: var(--admin-muted);
    font-size: 13px;
    font-weight: 600;
}

/* ============================================================
   TOOLBAR
   ============================================================ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn,
button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 16px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--admin-green);
    color: white;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover,
button.btn:hover {
    background: var(--admin-green-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 61, 40, 0.22);
}

.btn:active,
button.btn:active {
    transform: translateY(0);
}

.btn.secondary {
    background: var(--admin-amber);
    color: #2a1c00;
}

.btn.secondary:hover {
    background: #c08520;
    color: #2a1c00;
}

.btn.outline {
    background: white;
    border-color: var(--admin-line);
    color: var(--admin-dark);
}

.btn.outline:hover {
    border-color: var(--admin-green);
    color: var(--admin-green);
    background: white;
}

.btn.danger {
    background: var(--admin-red);
}

.btn.danger:hover {
    background: #a93226;
}

/* ============================================================
   TABLE
   ============================================================ */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid var(--admin-line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    font-size: 14px;
}

th,
td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--admin-line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--admin-muted);
    background: #f8faf7;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

tr:last-child td {
    border-bottom: 0;
}

tbody tr {
    transition: background var(--transition);
}

tbody tr:hover {
    background: #f7faf7;
}

/* ============================================================
   ACTIONS & BADGES
   ============================================================ */
.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: #e8f5ec;
    color: #0d5c2a;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge.draft,
.badge.passive,
.badge.archived {
    background: #fdf3e3;
    color: #7a4c0e;
}

.badge.new {
    background: #e8f0fb;
    color: #1a3c8f;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.field {
    display: grid;
    gap: 7px;
}

.field.full {
    grid-column: 1 / -1;
}

label {
    color: var(--admin-dark);
    font-weight: 700;
    font-size: 14px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    border: 1.5px solid var(--admin-line);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--admin-ink);
    font: inherit;
    font-size: 14.5px;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--admin-green);
    box-shadow: 0 0 0 3px rgba(26, 122, 74, 0.14);
}

input::placeholder,
textarea::placeholder {
    color: #aab5af;
}

textarea {
    min-height: 180px;
    resize: vertical;
    line-height: 1.6;
}

.help {
    color: var(--admin-muted);
    font-size: 13px;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    margin-bottom: 20px;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid #b0d9c2;
    background: #edf9f3;
    color: #0d4a28;
    font-weight: 600;
    font-size: 14.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert::before {
    content: '✓';
    font-weight: 900;
    font-size: 15px;
    color: var(--admin-green);
    flex-shrink: 0;
}

.alert.error {
    border-color: #e5b5b5;
    background: #fff0f0;
    color: #8b2f2f;
}

.alert.error::before {
    content: '✕';
    color: var(--admin-red);
}

/* ============================================================
   MISC
   ============================================================ */
.thumb {
    width: 88px;
    height: 58px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: #edf1ed;
}

.empty {
    padding: 36px 24px;
    border: 1.5px dashed var(--admin-line);
    border-radius: var(--radius);
    background: white;
    color: var(--admin-muted);
    text-align: center;
    font-size: 14.5px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        overflow: visible;
    }

    .sidebar-brand {
        padding: 16px 20px;
    }

    .side-nav {
        grid-template-columns: repeat(3, 1fr);
        padding: 12px 12px 16px;
    }

    .side-nav span {
        grid-column: 1 / -1;
        margin-top: 8px;
    }

    .grid.four {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid.two {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .admin-content {
        padding: 20px;
    }
}

@media (max-width: 640px) {
    .side-nav {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid.four,
    .grid.three,
    .grid.two {
        grid-template-columns: 1fr;
    }

    .admin-top {
        padding: 0 16px;
    }

    .admin-content {
        padding: 16px;
    }
}
