@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --teal:       #1a8c7e;
    --teal-light: #22b0a0;
    --teal-soft:  #e8f5f3;
    --navy:       #0d1f2d;
    --ink:        #1c2a24;
    --muted:      #607068;
    --line:       #dce8e4;
    --paper:      #ffffff;
    --foam:       #f2f8f6;
    --sand:       #f7f3ee;
    --danger:     #c0392b;
    --shadow-sm:  0 2px 12px rgba(13, 31, 45, 0.07);
    --shadow-md:  0 8px 32px rgba(13, 31, 45, 0.12);
    --radius:     10px;
}

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

body.admin-body {
    margin: 0;
    color: var(--ink);
    background: var(--sand);
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* TOPBAR */
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 64px;
    padding: 12px 28px;
    color: #fff;
    background: var(--navy);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.admin-brand {
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    color: #fff;
    letter-spacing: -0.01em;
}

.admin-topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.admin-topbar nav a {
    padding: 7px 13px;
    border-radius: 8px;
    color: rgba(255,255,255,0.75);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.18s, color 0.18s;
}

.admin-topbar nav a:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* MAIN */
.admin-main {
    width: min(1180px, calc(100% - 36px));
    margin: 0 auto;
    padding: 32px 0 72px;
}

.admin-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.admin-title h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

/* CARDS */
.admin-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow-sm);
}

.login-card {
    max-width: 440px;
    padding: 28px;
}

/* GRIDS */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.admin-grid.two {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 20px;
}

.action-card {
    padding: 24px;
    text-decoration: none;
    transition: box-shadow 0.2s, transform 0.2s;
}

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

.action-card h2 { margin: 0 0 8px; font-size: 20px; font-weight: 700; }
.action-card p  { margin: 0; color: var(--muted); font-size: 14px; }

/* METRICS */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 20px;
}

.metric {
    padding: 22px 24px;
    border-radius: var(--radius);
    color: #fff;
    background: linear-gradient(135deg, var(--teal) 0%, var(--teal-light) 100%);
}

.metric strong { display: block; font-size: 36px; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.metric span   { font-size: 13px; font-weight: 500; opacity: 0.88; }

/* FLASH / ALERTS */
.admin-flashes { display: grid; gap: 10px; margin-bottom: 20px; }

.admin-flash,
.admin-alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
}

.admin-flash.success { color: #fff; background: var(--teal); }
.admin-flash.error,
.admin-alert          { color: #fff; background: var(--danger); }

/* FORMS */
.admin-form { display: grid; gap: 18px; }
.admin-form.wide { padding: 24px; }

.admin-form label {
    display: grid;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

input, select, textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: var(--paper);
    font: inherit;
    font-size: 15px;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--teal);
}

textarea { resize: vertical; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

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

.checkbox-row, .radio-row {
    display: flex !important;
    align-items: center;
    gap: 10px;
    text-transform: none;
    letter-spacing: 0;
    font-size: 15px;
}

.checkbox-row input, .radio-row input {
    width: auto;
    min-height: auto;
}

.form-actions, .admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0;
}

/* BUTTONS */
.admin-button, .row-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 9px 16px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    background: var(--paper);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.18s;
}

.admin-button:hover { background: var(--foam); border-color: var(--teal); color: var(--teal); }

.admin-button.primary {
    color: #fff;
    border-color: var(--teal);
    background: var(--teal);
}

.admin-button.primary:hover {
    background: var(--teal-light);
    border-color: var(--teal-light);
    color: #fff;
}

.admin-button.danger, .row-actions button {
    color: #fff;
    border-color: var(--danger);
    background: var(--danger);
}

.admin-button.small { min-height: 34px; padding: 6px 12px; font-size: 13px; }

/* TABLE */
.table-card { overflow-x: auto; }

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

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

.admin-table th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--foam);
}

.admin-table td span, .admin-table td a { display: block; color: var(--muted); font-size: 14px; }

.row-actions { min-width: 200px; }
.row-actions a, .row-actions form { display: inline-block; margin: 0 6px 6px 0; }
.row-actions a { color: var(--teal); font-weight: 600; font-size: 14px; }

.messages-table tr.unread { background: #f0fbf9; }

.cover-preview {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* GALLERY ADMIN */
.gallery-admin-form { padding: 18px; }

.gallery-admin-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.gallery-admin-item {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
}

.gallery-admin-item img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
}

@media (max-width: 980px) {
    .admin-grid, .admin-grid.two, .metric-grid, .gallery-admin-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 680px) {
    .admin-topbar { align-items: flex-start; flex-direction: column; }

    .admin-grid, .admin-grid.two, .metric-grid,
    .form-grid, .form-grid.thirds, .gallery-admin-grid {
        grid-template-columns: 1fr;
    }

    .admin-title h1 { font-size: 24px; }
}
