/* ==========================================================================
   Dawa Pack - CMS Admin Stylesheet
   ========================================================================== */
:root {
    --bg-dark: #08080c;
    --bg-card: #111116;
    --bg-input: #181822;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(239, 68, 68, 0.15);
    
    --primary-red: #ef4444;
    --primary-red-hover: #dc2626;
    --primary-blue: #1877f2;
    --primary-blue-hover: #145dbf;
    --primary-green: #10b981;
    
    --text-white: #ffffff;
    --text-gray: #a1a1aa;
    --text-muted: #71717a;
    
    --font-main: 'Outfit', sans-serif;
    --font-heading: 'Cabinet Grotesk', 'Outfit', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-premium: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: var(--font-main);
    overflow-x: hidden;
    line-height: 1.5;
}

/* ==========================================================================
   Login Screen
   ========================================================================== */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.login-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-premium);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.login-logo {
    width: 64px;
    height: auto;
    margin-bottom: 20px;
}

.login-card h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.login-card p {
    color: var(--text-gray);
    font-size: 0.95rem;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-gray);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-white);
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 10px var(--border-glow);
}

.btn-login {
    width: 100%;
    background-color: var(--primary-red);
    color: var(--text-white);
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-top: 10px;
}

.btn-login:hover {
    background-color: var(--primary-red-hover);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.login-error {
    color: var(--primary-red);
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 15px;
    display: none;
}

/* ==========================================================================
   Admin Shell Layout
   ========================================================================== */
.admin-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 280px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition-smooth);
}

.sidebar-header {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    width: 36px;
    height: auto;
}

.sidebar-brand-name {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.sidebar-menu {
    flex-grow: 1;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-gray);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.menu-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.menu-item:hover {
    color: var(--text-white);
    background-color: rgba(255, 255, 255, 0.03);
}

.menu-item.active {
    color: var(--text-white);
    background-color: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.15);
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-profile-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-red);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.user-meta-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-white);
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-meta-role {
    font-size: 0.75rem;
    color: var(--text-gray);
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

.btn-logout:hover {
    color: var(--primary-red);
}

/* Main Container */
.admin-main {
    flex-grow: 1;
    margin-left: 280px;
    padding: 40px;
    transition: var(--transition-smooth);
    min-height: 100vh;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Header */
.admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.admin-page-header h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
}

.admin-page-header p {
    color: var(--text-gray);
    font-size: 0.95rem;
    margin-top: 4px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-cms {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-cms-primary {
    background-color: var(--primary-red);
    color: var(--text-white);
}

.btn-cms-primary:hover {
    background-color: var(--primary-red-hover);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-cms-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: var(--text-white);
}

.btn-cms-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.btn-cms-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--primary-red);
}

.btn-cms-danger:hover {
    background-color: var(--primary-red);
    color: var(--text-white);
}

.btn-cms-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
}

/* ==========================================================================
   Dashboard Widgets
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-premium);
}

.stat-info h3 {
    font-size: 0.85rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-val {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
}

.stat-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-icon-wrapper.red {
    background-color: rgba(239, 68, 68, 0.08);
    color: var(--primary-red);
}

.stat-icon-wrapper.blue {
    background-color: rgba(24, 119, 242, 0.08);
    color: var(--primary-blue);
}

.stat-icon-wrapper.green {
    background-color: rgba(16, 185, 129, 0.08);
    color: var(--primary-green);
}

/* Chart Container & Activity */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
}

.panel-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-premium);
    margin-bottom: 20px;
}

.panel-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Chart Mockup */
.chart-mockup {
    height: 250px;
    position: relative;
    border-bottom: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    margin: 20px 0 10px 10px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding-bottom: 5px;
}

.chart-bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 10%;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 100%;
    background: linear-gradient(180deg, var(--primary-red) 0%, rgba(239,68,68,0.2) 100%);
    border-radius: 6px 6px 0 0;
    transition: height 1s ease-out;
}

.chart-label {
    font-size: 0.75rem;
    color: var(--text-gray);
    margin-top: 10px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.activity-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.activity-badge.add {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--primary-green);
}

.activity-badge.edit {
    background-color: rgba(24, 119, 242, 0.1);
    color: var(--primary-blue);
}

.activity-badge.delete {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--primary-red);
}

.activity-info p {
    font-size: 0.85rem;
    font-weight: 500;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==========================================================================
   Tables
   ========================================================================== */
.table-container {
    overflow-x: auto;
}

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

.cms-table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-gray);
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.cms-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    vertical-align: middle;
}

.cms-table tr:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

.table-img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.table-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-red { background-color: rgba(239, 68, 68, 0.1); color: var(--primary-red); }
.badge-blue { background-color: rgba(24, 119, 242, 0.1); color: var(--primary-blue); }
.badge-gold { background-color: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.badge-green { background-color: rgba(16, 185, 129, 0.1); color: var(--primary-green); }

.table-actions {
    display: flex;
    gap: 8px;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.cms-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cms-modal-backdrop.hidden {
    display: none;
}

.cms-modal {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    animation: modalSlide 0.3s ease-out;
}

.cms-modal.wide {
    max-width: 800px;
}

@keyframes modalSlide {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.cms-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cms-modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 800;
}

.cms-modal-close {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.cms-modal-close:hover {
    color: var(--primary-red);
}

.cms-modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.cms-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==========================================================================
   Media File Manager Components
   ========================================================================== */
.media-manager-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.media-item {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.media-item:hover {
    border-color: var(--primary-red);
    background-color: rgba(239, 68, 68, 0.02);
}

.media-preview-box {
    aspect-ratio: 1;
    border-radius: 8px;
    background-color: #0d0d11;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 10px;
}

.media-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-preview-box i {
    font-size: 2rem;
    color: var(--text-gray);
}

.media-name {
    font-size: 0.75rem;
    color: var(--text-white);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    background-color: rgba(255,255,255,0.01);
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-bottom: 20px;
}

.upload-dropzone:hover {
    border-color: var(--primary-red);
    background-color: rgba(239, 68, 68, 0.02);
}

.upload-dropzone i {
    font-size: 2.5rem;
    color: var(--primary-red);
    margin-bottom: 15px;
}

/* ==========================================================================
   Pages Dashboard List
   ========================================================================== */
.pages-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.page-row-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-smooth);
}

.page-row-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.page-row-info h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.page-row-info p {
    font-size: 0.8rem;
    color: var(--text-gray);
}

.page-row-info code {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 8px;
}

/* Toggle Switch */
.switch-control {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch-control input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.1);
    border: 1px solid var(--border-color);
    transition: .3s;
    border-radius: 24px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-gray);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .switch-slider {
    background-color: var(--primary-green);
}

input:checked + .switch-slider:before {
    transform: translateX(24px);
    background-color: #ffffff;
}

/* Grid Layout for Settings Forms */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.textarea-full {
    grid-column: span 2;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    
    .admin-sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .admin-main {
        margin-left: 0;
        padding: 20px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .textarea-full {
        grid-column: span 1;
    }
}

/* Global utility classes */
.hidden {
    display: none !important;
}
