/* ==========================================
   BIHAR YOJNA PORTAL - ADMIN STYLES
   File: css/admin.css
   Size: ~5KB | Clean Dashboard UI
   ========================================== */

/* === RESET === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === VARIABLES === */
:root {
    --p: #E63946;
    --pd: #C1121F;
    --s: #1D3557;
    --a: #F77F00;
    --al: #FCBF49;
    --ok: #06D6A0;
    --info: #118AB2;
    --bg: #f4f6f9;
    --w: #fff;
    --td: #1a1a2e;
    --tm: #4a4a6a;
    --tl: #8a8aaa;
    --rs: 8px;
    --rm: 12px;
    --rl: 16px;
    --sm: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* === BASE === */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans Devanagari', sans-serif;
    background: var(--bg);
    color: var(--td);
    line-height: 1.5;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--s), #457B9D);
}

.login-box {
    background: var(--w);
    padding: 40px;
    border-radius: var(--rm);
    box-shadow: var(--sm);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box .logo-login {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.login-box h2 {
    color: var(--s);
    font-size: 1.5rem;
    margin-bottom: 6px;
    font-weight: 800;
}

.login-box > p {
    color: var(--tm);
    font-size: 0.85rem;
    margin-bottom: 28px;
}

.login-box .fg {
    margin-bottom: 16px;
    text-align: left;
}

.login-box label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--tm);
    display: block;
    margin-bottom: 6px;
}

.login-box input[type="email"],
.login-box input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e8e8f0;
    border-radius: var(--rs);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--td);
    transition: 0.3s;
    background: #fafafa;
}

.login-box input:focus {
    outline: 0;
    border-color: var(--p);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--p), var(--pd));
    color: #fff;
    border: 0;
    border-radius: var(--rs);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 8px;
}

.login-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(230, 57, 70, 0.3);
}

.login-err {
    color: var(--p);
    font-size: 0.85rem;
    margin-top: 14px;
    display: none;
    padding: 10px;
    background: #FFF5F5;
    border-radius: var(--rs);
}

/* ============================================
   ADMIN LAYOUT
   ============================================ */
.admin-wrap {
    display: none;
    min-height: 100vh;
}

/* --- Header --- */
.admin-header {
    background: var(--w);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header h1 {
    font-size: 1.1rem;
    color: var(--s);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
}

.admin-header .user-info {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.82rem;
    color: var(--tm);
}

.user-badge {
    background: #E3F2FD;
    color: #1565C0;
    padding: 4px 12px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.75rem;
}

.logout-btn {
    padding: 8px 18px;
    background: var(--p);
    color: #fff;
    border: 0;
    border-radius: var(--rs);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.8rem;
    transition: 0.3s;
}

.logout-btn:hover {
    background: var(--pd);
    transform: translateY(-1px);
}

/* --- Navigation --- */
.admin-nav {
    background: var(--w);
    padding: 12px 24px;
    border-bottom: 1px solid #e8e8f0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-nav button {
    padding: 8px 20px;
    border: 2px solid #e8e8f0;
    border-radius: 50px;
    background: var(--w);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--tm);
    cursor: pointer;
    transition: 0.3s;
}

.admin-nav button:hover {
    border-color: var(--p);
    color: var(--p);
}

.admin-nav button.active {
    background: var(--p);
    color: #fff;
    border-color: var(--p);
}

/* --- Content Area --- */
.admin-content {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

/* ============================================
   DASHBOARD
   ============================================ */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dash-card {
    background: var(--w);
    padding: 24px;
    border-radius: var(--rm);
    box-shadow: var(--sm);
    border-left: 5px solid var(--p);
    transition: 0.3s;
}

.dash-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.dash-card h3 {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--s);
}

.dash-card p {
    font-size: 0.82rem;
    color: var(--tm);
    margin-top: 4px;
}

.dash-card.green {
    border-color: var(--ok);
}

.dash-card.orange {
    border-color: var(--a);
}

.dash-card.blue {
    border-color: var(--info);
}

/* ============================================
   DATA TABLE
   ============================================ */
.admin-table-wrap {
    background: var(--w);
    border-radius: var(--rm);
    box-shadow: var(--sm);
    overflow: hidden;
    margin-bottom: 20px;
}

.table-header {
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #f0f0f5;
    flex-wrap: wrap;
    gap: 12px;
}

.table-header h3 {
    font-size: 1.1rem;
    color: var(--s);
    font-weight: 700;
}

.add-btn {
    padding: 10px 22px;
    background: linear-gradient(135deg, var(--p), var(--pd));
    color: #fff;
    border: 0;
    border-radius: var(--rs);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.3s;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(230, 57, 70, 0.3);
}

.table-scroll {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    text-align: left;
    padding: 12px 18px;
    background: var(--bg);
    font-size: 0.72rem;
    color: var(--tl);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    white-space: nowrap;
}

.admin-table td {
    padding: 14px 18px;
    border-bottom: 1px solid #f0f0f5;
    font-size: 0.85rem;
    color: var(--td);
    vertical-align: middle;
}

.admin-table tr {
    transition: 0.2s;
}

.admin-table tbody tr:hover {
    background: #fafbff;
}

.admin-table .actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

.edit-btn {
    padding: 6px 14px;
    background: #E3F2FD;
    color: #1565C0;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    transition: 0.2s;
}

.edit-btn:hover {
    background: #BBDEFB;
}

.del-btn {
    padding: 6px 14px;
    background: #FCE4EC;
    color: #C62828;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    transition: 0.2s;
}

.del-btn:hover {
    background: #F8BBD0;
}

/* === Status Badge === */
.status-badge {
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-block;
}

.sb-active {
    background: #E8F5E9;
    color: #2E7D32;
}

.sb-inactive {
    background: #FCE4EC;
    color: #C62828;
}

/* ============================================
   ADMIN FORM
   ============================================ */
.admin-form {
    background: var(--w);
    border-radius: var(--rm);
    box-shadow: var(--sm);
    padding: 28px;
    display: none;
    margin-bottom: 20px;
    border: 2px solid #f0f0f5;
}

.admin-form.show {
    display: block;
    animation: fadeUp 0.4s ease;
}

.admin-form h3 {
    font-size: 1.1rem;
    color: var(--s);
    font-weight: 700;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 2px solid #f0f0f5;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.fg {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fg label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--tm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fg input[type="text"],
.fg input[type="number"],
.fg input[type="date"],
.fg input[type="url"],
.fg select,
.fg textarea {
    padding: 11px 14px;
    border: 2px solid #e8e8f0;
    border-radius: var(--rs);
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--td);
    transition: 0.3s;
    background: #fafafa;
}

.fg textarea {
    min-height: 80px;
    resize: vertical;
}

.fg input:focus,
.fg select:focus,
.fg textarea:focus {
    outline: 0;
    border-color: var(--a);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(247, 127, 0, 0.1);
}

.fg .help {
    font-size: 0.7rem;
    color: var(--tl);
    font-style: italic;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 2px solid #f0f0f5;
}

.save-btn {
    padding: 12px 32px;
    background: linear-gradient(135deg, var(--ok), #04b890);
    color: #fff;
    border: 0;
    border-radius: var(--rs);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(6, 214, 160, 0.3);
}

.cancel-btn {
    padding: 12px 32px;
    background: #f0f0f5;
    color: var(--tm);
    border: 0;
    border-radius: var(--rs);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.3s;
}

.cancel-btn:hover {
    background: #e0e0e8;
}

/* ============================================
   SECTIONS
   ============================================ */
.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
    animation: fadeUp 0.3s ease;
}

/* ============================================
   GUIDE BOX
   ============================================ */
.guide-box {
    padding: 24px;
    color: var(--tm);
    line-height: 2;
}

.guide-box p {
    margin-bottom: 4px;
}

.guide-box .tip {
    margin-top: 14px;
    padding: 14px;
    background: #FFF3E0;
    border-radius: var(--rs);
    border-left: 4px solid var(--a);
}

.guide-box code {
    background: #f0f0f5;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--p);
}

/* ============================================
   TOAST
   ============================================ */
.a-toast {
    position: fixed;
    top: 70px;
    right: 16px;
    padding: 14px 22px;
    background: var(--w);
    border-radius: var(--rm);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 3000;
    transform: translateX(120%);
    transition: 0.4s;
    max-width: 360px;
    border-left: 4px solid var(--ok);
    font-size: 0.85rem;
    font-weight: 600;
}

.a-toast.show {
    transform: translateX(0);
}

.a-toast i {
    font-size: 1.2rem;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 968px) {
    .admin-header {
        padding: 12px 16px;
    }

    .admin-header h1 {
        font-size: 0.95rem;
    }

    .admin-nav {
        padding: 10px 16px;
        gap: 6px;
    }

    .admin-nav button {
        padding: 7px 14px;
        font-size: 0.75rem;
    }

    .admin-content {
        padding: 0 12px;
        margin: 14px auto;
    }
}

@media (max-width: 768px) {
    .dash-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .dash-card {
        padding: 18px;
    }

    .dash-card h3 {
        font-size: 1.6rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .admin-table {
        font-size: 0.75rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 12px;
    }

    .table-header {
        padding: 14px 16px;
    }

    .admin-form {
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
    }

    .save-btn,
    .cancel-btn {
        width: 100%;
        justify-content: center;
    }

    .admin-header .user-info span {
        display: none;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 28px 20px;
    }

    .admin-header h1 {
        font-size: 0.85rem;
    }

    .admin-header h1 span:last-child {
        display: none;
    }

    .dash-grid {
        grid-template-columns: 1fr 1fr;
    }

    .admin-table .actions {
        flex-direction: column;
        gap: 4px;
    }
}