/* Revamped Modern Admin Sidebar & Dashboard Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #f1f5f9;
}

.sidebar {
    width: 320px;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: white;
    padding: 1.6rem 1.25rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-title {
    font-size: 1.02rem;
    font-weight: 800;
    color: white;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.sidebar-title img {
    height: 26px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-title span {
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: -0.2px;
    white-space: nowrap;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex-grow: 1;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.85rem 1.1rem;
    border-radius: 12px;
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.25s ease;
}

.sidebar-menu a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    transform: translateX(4px);
}

.sidebar-menu a.active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

/* Fixed Bottom Sign Out Section in Admin Sidebar */
.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.25s ease;
}

.sidebar-logout-btn:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
}

.admin-main {
    flex-grow: 1;
    background: #f8fafc;
    padding: 2.5rem;
    overflow-x: hidden;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid #e2e8f0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid #e2e8f0;
}

.stat-number {
    font-size: 2.2rem;
    font-weight: 800;
    color: #0f172a;
    margin-top: 0.5rem;
}

.stat-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
}

.table-responsive {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    overflow-x: auto;
    border: 1px solid #e2e8f0;
}

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

.admin-table th, .admin-table td {
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid #e2e8f0;
}

.admin-table th {
    background: #f8fafc;
    font-weight: 800;
    color: #334155;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-status {
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
}

.badge-published {
    background: #dcfce7;
    color: #166534;
}

.badge-hidden {
    background: #fee2e2;
    color: #991b1b;
}

.badge-draft {
    background: #fef3c7;
    color: #92400e;
}

/* ==========================================================================
   ADMIN MOBILE RESPONSIVE STYLES
   ========================================================================== */

@media (max-width: 991px) {
    .admin-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        padding: 1rem 1.2rem;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    }

    .sidebar-title {
        margin-bottom: 0.8rem;
        padding-bottom: 0.6rem;
    }

    .sidebar-menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .sidebar-menu a {
        padding: 0.55rem 0.85rem;
        font-size: 0.85rem;
        border-radius: 8px;
    }

    .sidebar-footer {
        margin-top: 0.8rem;
        padding-top: 0.6rem;
    }

    .sidebar-logout-btn {
        padding: 0.55rem 0.85rem;
        font-size: 0.85rem;
    }

    .admin-main {
        padding: 1.2rem 1rem;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-number {
        font-size: 1.6rem;
    }
}

@media (max-width: 640px) {
    .sidebar-menu {
        flex-direction: column;
    }

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

    .admin-header h1 {
        font-size: 1.4rem !important;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.75rem 0.7rem;
        font-size: 0.82rem;
    }
}

/* ==========================================================================
   Modern Unified Rich Text Editor Component
   ========================================================================== */
.rich-editor-wrapper {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    margin-top: 0.4rem;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.rich-editor-wrapper:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
}

.rich-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    background: #f8fafc;
    padding: 0.6rem 0.85rem;
    border-bottom: 1.5px solid #e2e8f0;
    width: 100%;
    box-sizing: border-box;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: #cbd5e1;
    margin: 0 0.45rem;
}

.editor-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #334155;
    padding: 0.42rem 0.8rem;
    font-size: 0.84rem;
    font-weight: 700;
    font-family: inherit;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.editor-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.editor-btn:active {
    background: #e2e8f0;
    transform: translateY(0);
}

.editor-btn i {
    font-size: 0.88rem;
    color: #64748b;
    transition: color 0.15s ease;
}

.editor-btn:hover i {
    color: #2563eb;
}

.rich-editor-textarea {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent;
    padding: 1rem 1.15rem;
    font-size: 0.98rem;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    color: #0f172a;
    line-height: 1.7;
    white-space: pre-wrap;
    resize: vertical;
    display: block;
}

.rich-editor-textarea::placeholder {
    color: #94a3b8;
}

/* Global Elegant Top Page Loading Progress Bar */
.page-loader-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3.5px;
    width: 0%;
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 50%, #f97316 100%);
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.6), 0 0 5px rgba(249, 115, 22, 0.4);
    z-index: 9999999;
    pointer-events: none;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
}

.page-loader-bar.loading {
    opacity: 1;
}

/* Modal Entrance & Content Loading Animation */
.modal-overlay {
    transition: opacity 0.25s ease, backdrop-filter 0.25s ease;
}

.modal-card {
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s ease;
}

.modal-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3.5px solid rgba(37, 99, 235, 0.2);
    border-radius: 50%;
    border-top-color: #2563eb;
    animation: bbbSpin 0.75s linear infinite;
    margin: 1.5rem auto;
}

@keyframes bbbSpin {
    to { transform: rotate(360deg); }
}

@keyframes bbbPageFadeIn {
    from { opacity: 0.88; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

.admin-main, .container {
    animation: bbbPageFadeIn 0.25s ease-out;
}

.modal-close {
    position: absolute;
    top: 1.1rem;
    right: 1.1rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    color: #64748b;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    z-index: 50;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.modal-close:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #ef4444;
    transform: rotate(90deg) scale(1.08);
}

.modal-close i {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    font-size: 1rem !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
}

/* Universal Page Transition Overlay */
.page-transition-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9999998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-transition-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.page-transition-pill {
    background: #ffffff;
    padding: 0.85rem 1.6rem;
    border-radius: 50px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.22);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border: 1px solid rgba(226, 232, 240, 0.9);
    animation: bbbPulsePill 1.2s ease-in-out infinite;
}

.page-transition-spinner {
    width: 22px;
    height: 22px;
    border: 2.8px solid #dbeafe;
    border-radius: 50%;
    border-top-color: #2563eb;
    animation: bbbSpin 0.65s linear infinite;
    flex-shrink: 0;
}

.page-transition-brand {
    font-size: 0.98rem;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.page-transition-brand span {
    color: #f59e0b;
}

.page-transition-text {
    font-size: 0.84rem;
    color: #64748b;
    font-weight: 600;
    border-left: 1.5px solid #e2e8f0;
    padding-left: 0.65rem;
    margin-left: 0.2rem;
}

