/* ============================================================
   ADMIN PANEL — BLACK & WHITE THEME
   Loaded after style.css on all admin management pages.
   ============================================================ */

:root {
    /* Black & white palette */
    --admin-ink: #111111;
    --admin-ink-soft: #333333;
    --admin-muted: #6f6f6f;
    --admin-bg: #f2f2f2;
    --admin-surface: #ffffff;
    --admin-line: #e0e0e0;
    --admin-line-soft: #ebebeb;
    --admin-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);

    /* Map template variables to the monochrome palette */
    --bg-dark: #111111;
    --bg-card: #ffffff;
    --bg-section: #f4f4f4;
    --border: #e0e0e0;
    --primary: #111111;
    --primary-light: #111111;
    --accent: #333333;
    --text-muted: #6f6f6f;
    --text-secondary: #444444;
    --text-primary: #111111;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.08);

    /* Neutralize green variables inherited from style.css */
    --green: #333333;
    --green-dark: #111111;
    --green-mid: #3a3a3a;
    --green-light: #4a4a4a;
    --green-soft: #eeeeee;
    --green-glow: rgba(0, 0, 0, 0.14);
    --bg: #f2f2f2;
    --surface: #ffffff;
    --text: #1a1a1a;
    --text-2: #444444;
    --text-3: #8a8a8a;
}

/* ---- Base ---- */
.admin-layout { display: flex; min-height: 100vh; }

body.admin-login-body,
body:not(.page-home):not(.page-detail) {
    background: var(--admin-bg);
    color: var(--admin-ink);
}

/* ---- Sidebar ---- */
.admin-sidebar {
    width: 260px;
    background: var(--admin-ink);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    color: #fff;
}
.admin-sidebar::-webkit-scrollbar { width: 6px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.admin-main { flex: 1; margin-left: 260px; padding: 2rem; min-width: 0; }

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.5rem 0 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}
.sidebar-logo-img { width: 36px; height: 36px; filter: brightness(0) invert(1); }
.sidebar-logo-text { font-family: 'Space Grotesk', sans-serif; font-weight: 700; color: #fff; }

.sidebar-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #8f8f8f;
    padding: 1rem 1rem 0.5rem;
}

.sidebar-nav { list-style: none; display: flex; flex-direction: column; gap: 0.3rem; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    color: #b8b8b8;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.sidebar-nav a.active { background: rgba(255, 255, 255, 0.1); color: #fff; border-left: 3px solid #fff; }

/* ---- Header ---- */
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.admin-header h1 { font-family: 'Space Grotesk', sans-serif; font-size: 1.8rem; color: var(--admin-ink); }
.admin-header p { color: var(--admin-muted); }

/* ---- Cards ---- */
.admin-card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-line);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--admin-shadow);
}
.admin-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--admin-line);
}
.admin-card-title { font-family: 'Space Grotesk', sans-serif; font-size: 1.1rem; font-weight: 700; color: var(--admin-ink); }

/* ---- Stat grid ---- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; margin-bottom: 2rem; }
.admin-stat {
    background: var(--admin-surface);
    border: 1px solid var(--admin-line);
    border-radius: 14px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--admin-shadow);
}
.admin-stat:hover { border-color: var(--admin-ink); transform: translateY(-2px); }
.admin-stat-icon {
    width: 45px; height: 45px;
    background: #eee;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; color: var(--admin-ink); margin-bottom: 1rem;
}
.admin-stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 2rem; font-weight: 700; color: var(--admin-ink); }
.admin-stat-label { color: var(--admin-muted); font-size: 0.85rem; margin-top: 0.3rem; }

/* ---- Tables ---- */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th {
    text-align: left;
    padding: 0.8rem;
    color: var(--admin-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--admin-line);
}
.admin-table td { padding: 0.8rem; border-bottom: 1px solid var(--admin-line); font-size: 0.9rem; color: var(--admin-ink); }
.admin-table tr:hover td { background: #f7f7f7; }
.admin-table a { color: var(--admin-ink); }

/* ---- Badges ---- */
.badge { padding: 0.25rem 0.7rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.badge-green { background: #1a1a1a; color: #fff; border: 1px solid #1a1a1a; }
.badge-yellow { background: #e9e9e9; color: #222; border: 1px solid #d0d0d0; }
.badge-red { background: #fff; color: #1a1a1a; border: 1px solid #1a1a1a; }
.badge-blue { background: #e9e9e9; color: #222; border: 1px solid #d0d0d0; }

/* ---- Progress ---- */
.progress-bar { height: 6px; background: #e5e5e5; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #333, #111); border-radius: 3px; transition: width 0.5s ease; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.7rem 1.3rem;
    border-radius: 10px;
    background: #f2f2f2;
    color: var(--admin-ink);
    border: 1px solid #d8d8d8;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s ease;
    line-height: 1.4;
}
.btn:hover { background: #e6e6e6; border-color: #bdbdbd; }
.btn-primary { background: var(--admin-ink); color: #fff; border-color: var(--admin-ink); }
.btn-primary:hover { background: #333; border-color: #333; }
.btn-primary i { color: #fff; }
.btn-outline { background: #fff; color: var(--admin-ink); border: 1px solid #cccccc; }
.btn-outline:hover { background: #000; color: #fff; border-color: #000; }
.btn-outline:hover i { color: #fff; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.45rem;
}
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid #d4d4d4;
    border-radius: 10px;
    background: #fff;
    color: var(--admin-ink);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: #111;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select { cursor: pointer; }
.form-hint { font-size: 0.78rem; color: var(--admin-muted); margin-top: 0.35rem; }
input[type="range"] { accent-color: #111; }
input[type="checkbox"] { accent-color: #111; }

/* ---- Notification banners (inline-styled via vars, neutralized bg) ---- */
.alert-banner {
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* ---- Upload area ---- */
.upload-area {
    border: 2px dashed #cfcfcf;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: #fafafa;
}
.upload-area:hover { border-color: #111; background: #f4f4f4; }
.upload-area input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-area i { font-size: 2rem; color: #333; margin-bottom: 0.5rem; display: block; }
.upload-area p { color: var(--admin-muted); font-size: 0.85rem; }

.upload-preview {
    width: 120px; height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #111;
    margin: 0 auto 1rem;
    display: block;
    background: #fff;
}
.upload-preview-placeholder {
    width: 120px; height: 120px;
    border-radius: 50%;
    background: var(--bg-section);
    border: 2px dashed #ccc;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2.5rem;
    color: var(--admin-muted);
}

/* ---- Login ---- */
.login-container { width: 100%; max-width: 420px; padding: 2rem; }
.login-card {
    background: var(--admin-surface);
    border: 1px solid var(--admin-line);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-title { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--admin-ink); }
.login-subtitle { color: var(--admin-muted); font-size: 0.9rem; margin-top: 0.5rem; }
.login-error {
    background: #f4f4f4;
    border: 1px solid #c9c9c9;
    border-radius: 10px;
    padding: 0.8rem 1rem;
    color: #111;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    display: flex; align-items: center; gap: 8px;
}
.login-footer { text-align: center; margin-top: 1.5rem; }
.login-footer a { color: var(--admin-muted); text-decoration: none; font-size: 0.85rem; transition: color 0.3s ease; }
.login-footer a:hover { color: #111; }

/* ---- Logout / view links ---- */
.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    margin-top: 1rem;
}
.logout-btn:hover { background: rgba(255, 255, 255, 0.14); }
.view-link { color: #111; text-decoration: none; font-size: 0.85rem; transition: opacity 0.3s ease; }
.view-link:hover { opacity: 0.6; }
a[style*="margin-right"], a[href*="edit="] { text-decoration: none; }

/* ---- SMS panel ---- */
.sms-tabs { display: flex; gap: 0; border-bottom: 2px solid #ddd; margin-bottom: 1.5rem; }
.sms-tab {
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--admin-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}
.sms-tab.active { color: #111; border-bottom-color: #111; }
.sms-tab:hover { color: #111; }
.sms-panel { display: none; }
.sms-panel.active { display: block; }
.preview-box { background: #141414; color: #e0e0e0; padding: 1.5rem; border-radius: 16px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; max-width: 380px; margin: 0 auto; }
.preview-header { display: flex; align-items: center; gap: 8px; margin-bottom: 0.8rem; padding-bottom: 0.6rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.preview-sender { font-weight: 700; color: #ffffff; font-size: 0.9rem; }
.preview-time { color: #888; font-size: 0.7rem; margin-left: auto; }
.preview-body { font-size: 0.9rem; line-height: 1.6; white-space: pre-line; }
.stat-pill { display: inline-flex; align-items: center; gap: 6px; padding: 0.4rem 1rem; border-radius: 20px; font-size: 0.8rem; font-weight: 600; }
.stat-pill-green { background: #1a1a1a; color: #fff; }
.stat-pill-red { background: #fff; color: #111; border: 1px solid #111; }
.stat-pill-blue { background: #ececec; color: #111; }
.name-tag { background: #111; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; cursor: pointer; }

/* ---- Utility ---- */
a { color: var(--admin-ink); }

@media (max-width: 1024px) {
    .admin-sidebar { display: none; }
    .admin-main { margin-left: 0; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}