/* ==========================================================================
   Haayan Publications e-Cpanel - Master Administration Stylesheet
   Modern, Ultra-Premium, Dynamic Theme
   ========================================================================== */

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

:root {
    --font-primary: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Palette */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    --primary-rgb: 79, 70, 229;

    --secondary: #0ea5e9;
    --secondary-hover: #0284c7;

    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #06b6d4;
    --info-light: #cffafe;

    /* Layout colors */
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #252b48;
    --sidebar-border: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;

    --topbar-bg: rgba(255, 255, 255, 0.95);
    --topbar-border: #e2e8f0;

    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.25);

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Reset & Typography */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: var(--body-bg);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-size: 0.925rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* Layout Architecture */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
    overflow-x: hidden;
}

/* Sidebar */
.admin-sidebar {
    width: 270px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    border-right: 1px solid var(--sidebar-border);
    transition: var(--transition);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.admin-sidebar::-webkit-scrollbar {
    width: 5px;
}
.admin-sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar-brand {
    padding: 1.5rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--sidebar-border);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0) 100%);
}

.brand-icon-box {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.brand-text h5 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}

.brand-text span {
    font-size: 0.72rem;
    letter-spacing: 1px;
    color: var(--info);
    font-weight: 600;
}

/* Sidebar Nav */
.sidebar-menu {
    padding: 1.2rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex-grow: 1;
}

.nav-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #64748b;
    padding: 0.75rem 0.8rem 0.35rem;
    margin-top: 0.5rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.95rem;
    color: var(--sidebar-text);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.sidebar-nav-item .nav-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.sidebar-nav-item .nav-left i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    color: #64748b;
    transition: var(--transition);
}

.sidebar-nav-item:hover {
    background-color: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav-item:hover .nav-left i {
    color: var(--secondary);
    transform: scale(1.1);
}

.sidebar-nav-item.active {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.9) 0%, rgba(99, 102, 241, 0.8) 100%);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.sidebar-nav-item.active .nav-left i {
    color: #ffffff;
}

.nav-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
}

/* Sidebar Footer / User Widget */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--sidebar-border);
    background-color: rgba(15, 23, 42, 0.8);
}

.user-quick-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #10b981 100%);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    flex-shrink: 0;
}

.user-info-text {
    flex-grow: 1;
    overflow: hidden;
}

.user-info-text h6 {
    margin: 0;
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info-text span {
    font-size: 0.72rem;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 4px;
}

.user-info-text span::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--success);
}

/* Main Content Area */
.admin-main {
    margin-left: 270px;
    width: calc(100% - 270px);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

/* Header Topbar */
.admin-topbar {
    height: 70px;
    background: var(--topbar-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--topbar-border);
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.8rem;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle-btn {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.sidebar-toggle-btn:hover {
    background-color: #f1f5f9;
    color: var(--text-primary);
}

.topbar-search-form {
    position: relative;
    width: 320px;
}

.topbar-search-input {
    width: 100%;
    padding: 0.55rem 1rem 0.55rem 2.4rem;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    background-color: #f8fafc;
    font-size: 0.875rem;
    transition: var(--transition);
}
.topbar-search-input:focus {
    outline: none;
    background-color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.topbar-search-icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-action-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}
.topbar-action-btn:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-light);
}

.action-indicator {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: var(--danger);
    border: 2px solid #fff;
}

/* Page Content Body */
.admin-content {
    padding: 1.8rem;
    flex-grow: 1;
}

/* Page Header */
.page-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.8rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header-title h2 {
    font-size: 1.55rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-header-title p {
    margin: 0.25rem 0 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Metric Stats Cards */
.stat-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--card-accent, #6366f1), var(--card-accent-end, #8b5cf6));
}

.stat-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.9rem;
}

.stat-title {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.35rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-bottom {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Card variants */
.stat-primary .stat-icon-wrapper { background: rgba(79, 70, 229, 0.12); color: #4f46e5; }
.stat-primary { --card-accent: #4f46e5; --card-accent-end: #818cf8; }

.stat-success .stat-icon-wrapper { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.stat-success { --card-accent: #10b981; --card-accent-end: #34d399; }

.stat-warning .stat-icon-wrapper { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.stat-warning { --card-accent: #f59e0b; --card-accent-end: #fbbf24; }

.stat-info .stat-icon-wrapper { background: rgba(14, 165, 233, 0.12); color: #0ea5e9; }
.stat-info { --card-accent: #0ea5e9; --card-accent-end: #38bdf8; }

.stat-danger .stat-icon-wrapper { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.stat-danger { --card-accent: #ef4444; --card-accent-end: #f87171; }

/* Custom Content Cards */
.admin-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.8rem;
    overflow: hidden;
    transition: var(--transition);
}

.admin-card-header {
    padding: 1.25rem 1.6rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.admin-card-header h5 {
    font-size: 1.08rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.admin-card-header h5 i {
    color: var(--primary);
}

.admin-card-body {
    padding: 1.6rem;
}

.admin-card-body.p-0 {
    padding: 0;
}

/* Modern Data Tables */
.table-modern {
    width: 100%;
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;
}

.table-modern thead th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    border-top: none;
    white-space: nowrap;
}

.table-modern tbody td {
    padding: 1rem 1.25rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
    color: #334155;
    background-color: #ffffff;
    transition: background-color 0.15s ease;
}

.table-modern tbody tr:hover td {
    background-color: #f8fafc;
}

.table-modern tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.35rem 0.75rem;
    border-radius: 30px;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.pill-success {
    background-color: #dcfce7;
    color: #15803d;
}
.pill-success::before { background-color: #16a34a; }

.pill-warning {
    background-color: #fef3c7;
    color: #b45309;
}
.pill-warning::before { background-color: #f59e0b; }

.pill-info {
    background-color: #e0f2fe;
    color: #0369a1;
}
.pill-info::before { background-color: #0284c7; }

.pill-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}
.pill-danger::before { background-color: #dc2626; }

.pill-secondary {
    background-color: #f1f5f9;
    color: #475569;
}
.pill-secondary::before { background-color: #64748b; }

.pill-purple {
    background-color: #f3e8ff;
    color: #7e22ce;
}
.pill-purple::before { background-color: #9333ea; }

/* Action Buttons */
.btn-action-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-secondary);
    transition: var(--transition);
    font-size: 0.85rem;
}
.btn-action-icon:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-light);
}
.btn-action-icon.btn-action-danger:hover {
    background-color: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger-light);
}

.btn-primary-admin {
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #fff;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    transition: var(--transition);
}
.btn-primary-admin:hover {
    background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

/* Forms & Inputs */
.form-label {
    font-weight: 600;
    font-size: 0.84rem;
    color: #334155;
    margin-bottom: 0.4rem;
}

.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    color: #1e293b;
    background-color: #fff;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Image preview box */
.image-upload-preview-box {
    width: 140px;
    height: 190px;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: #f8fafc;
    transition: var(--transition);
}
.image-upload-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.image-upload-preview-box:hover {
    border-color: var(--primary);
    background-color: #f1f5f9;
}

/* Modern Tab Pill Bars */
.admin-tab-nav {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.admin-tab-btn {
    padding: 0.5rem 1.1rem;
    border-radius: 30px;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: #f1f5f9;
    border: 1px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.admin-tab-btn:hover {
    color: var(--text-primary);
    background: #e2e8f0;
}

.admin-tab-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.25);
}

/* Breadcrumbs */
.admin-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.admin-breadcrumb a {
    color: var(--text-secondary);
}
.admin-breadcrumb a:hover {
    color: var(--primary);
}

/* Flash alerts */
.admin-alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-alert-success { background: #dcfce7; color: #166534; border-left: 4px solid #16a34a; }
.admin-alert-danger { background: #fee2e2; color: #991b1b; border-left: 4px solid #dc2626; }
.admin-alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid #f59e0b; }
.admin-alert-info { background: #e0f2fe; color: #075985; border-left: 4px solid #0284c7; }

/* Login Page specific styling */
.login-body-bg {
    min-height: 100vh;
    background: radial-gradient(circle at 10% 20%, #1e1b4b 0%, #0f172a 90%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card-glass {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 2.8rem 2.4rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    color: #fff;
    position: relative;
}

.login-card-glass .form-control {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
}
.login-card-glass .form-control::placeholder {
    color: rgba(203, 213, 225, 0.55);
}
.login-card-glass .form-control:focus {
    background: rgba(15, 23, 42, 0.9);
    border-color: #818cf8;
    color: #fff;
}
.login-card-glass .form-label {
    color: #cbd5e1;
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.sidebar-open {
        transform: translateX(0);
    }
    .admin-main {
        margin-left: 0;
        width: 100%;
    }
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1035;
        display: none;
    }
    .sidebar-overlay.active {
        display: block;
    }
}
