﻿:root {
    --bg-main: #0a0d14;
    --bg-surface: #111622;
    --bg-card: rgba(22, 29, 45, 0.7);
    --bg-card-hover: rgba(30, 40, 62, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-active: rgba(99, 102, 241, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #6366f1;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    --primary-hover: #4f46e5;
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #06b6d4;
    --info-bg: rgba(6, 182, 212, 0.12);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Sidebar */
.app-sidebar {
    width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 50;
}

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

.brand-icon {
    width: 38px;
    height: 38px;
    background: var(--primary-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: 700;
    box-shadow: var(--shadow-glow);
}

.brand-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-badge {
    font-size: 10px;
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-left: auto;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    transform: translateX(3px);
}

.nav-link.active {
    color: #ffffff;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--border-active);
    font-weight: 600;
}

.nav-icon {
    width: 18px;
    height: 18px;
    opacity: 0.8;
}

/* Main Container */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-navbar {
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(17, 22, 34, 0.6);
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.content-body {
    padding: 32px;
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Glass Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-card);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Grid Layouts */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0.8;
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -1px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

/* Form controls */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    background: rgba(10, 13, 20, 0.8);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

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

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

.custom-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
}

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

.custom-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Alert Notification Toasts */
.alert-toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.alert-danger {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* Pages Checkbox Card */
.pages-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.page-select-card {
    background: rgba(10, 13, 20, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.page-select-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(15, 20, 32, 0.8);
}

.page-select-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.page-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

/* Mobile Navigation & Responsive Enhancements */
.mobile-toggle-btn {
    display: none;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 20px;
    padding: 6px 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    margin-left: auto;
    padding: 4px;
}

.sidebar-close-btn:hover {
    color: var(--text-primary);
}

.mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.mobile-backdrop.active {
    display: block;
    opacity: 1;
}

@media (max-width: 900px) {
    .mobile-toggle-btn {
        display: flex;
    }

    .sidebar-close-btn {
        display: block;
    }

    .hide-mobile {
        display: none !important;
    }

    .app-sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 100;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .app-sidebar.active {
        left: 0;
    }

    .app-main {
        width: 100%;
        min-width: 0;
    }

    .top-navbar {
        padding: 12px 16px;
    }

    .content-body {
        padding: 16px;
    }

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

    .pages-selection-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 540px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .page-title {
        font-size: 16px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* ========================================================
   COMPREHENSIVE MOBILE RESPONSIVENESS & TOUCH OPTIMIZATION
   ======================================================== */

.create-post-layout {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 24px;
    align-items: start;
    width: 100%;
}

.composer-sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.content-type-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.type-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    user-select: none;
}

.type-pill:has(input:checked) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    color: #fff;
}

.media-upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 24px 16px;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.media-upload-dropzone:hover {
    border-color: var(--primary);
}

.upload-icon {
    font-size: 32px;
    color: var(--primary);
    display: block;
    margin-bottom: 8px;
}

.preview-box {
    margin-top: 14px;
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-height: 260px;
    background: #000;
    text-align: center;
}

.quick-tags-container {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.tag-pill {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
}

.target-pages-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

.profile-filter-carousel {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.composer-pages-scroll {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.schedule-mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.schedule-radio-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.schedule-radio-pill:has(input:checked) {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
}

.schedule-datetime-box {
    background: rgba(0, 0, 0, 0.25);
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 14px;
}

.btn-publish-submit {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

@media (max-width: 992px) {
    .create-post-layout {
        grid-template-columns: 1fr;
        gap: 18px;
    }
}

@media (max-width: 768px) {
    .form-input, .form-textarea, .form-select {
        font-size: 16px !important;
    }

    .content-body {
        padding: 12px !important;
    }

    .glass-card {
        padding: 16px !important;
        border-radius: var(--radius-md) !important;
    }

    .top-navbar {
        padding: 10px 14px !important;
    }

    .top-actions {
        gap: 6px !important;
    }

    .page-title {
        font-size: 16px !important;
        max-width: 130px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -8px;
        padding: 0 8px;
    }

    .custom-table {
        min-width: 580px;
    }
}

@media (max-width: 480px) {
    .content-type-selector {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .type-pill {
        flex-direction: column;
        padding: 10px 4px;
        font-size: 11px;
        gap: 4px;
    }

    .type-pill i {
        font-size: 16px;
    }

    .btn-publish-submit {
        padding: 12px 10px;
        font-size: 13px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .stat-card {
        padding: 14px 12px !important;
    }

    .stat-value {
        font-size: 22px !important;
    }

    .stat-label {
        font-size: 11px !important;
    }
}

/* ========================================================
   SCHEDULED POSTS & HISTORY ENHANCEMENTS (DESKTOP & MOBILE)
   ======================================================== */

.schedule-filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    scrollbar-width: thin;
}

.tab-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.2s ease;
    user-select: none;
}

.tab-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

.tab-pill.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.tab-pill.alert-tab {
    border-color: rgba(245, 158, 11, 0.4);
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.1);
}

.tab-pill.alert-tab.active {
    background: #f59e0b;
    color: #000;
}

/* Thumbnail Previews */
.table-media-preview {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-video-badge {
    color: #ec4899;
    font-size: 24px;
}

.table-media-empty {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 18px;
}

/* History filter grid */
.history-filter-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 100px;
    gap: 14px;
    align-items: end;
}

/* Mobile cards for Scheduled & History */
.mobile-schedule-cards {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mobile-schedule-card {
    background: rgba(10, 13, 20, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: all 0.2s ease;
}

.mobile-schedule-card.card-overdue {
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.05);
}

.mobile-thumb-wrapper {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.thumb-img-mobile {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-video-badge-mobile {
    color: #ec4899;
    font-size: 28px;
}

.mobile-thumb-empty {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 22px;
    flex-shrink: 0;
}

/* Responsive visibility utilities */
.hide-on-desktop {
    display: none !important;
}

.hide-on-mobile {
    display: block !important;
}

@media (max-width: 860px) {
    .hide-on-desktop {
        display: flex !important;
    }

    .hide-on-mobile {
        display: none !important;
    }

    .history-filter-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.dashboard-cta-banner {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px 24px;
}

.dashboard-cta-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

@media (max-width: 768px) {
    .dashboard-cta-banner {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px;
        gap: 14px;
    }

    .dashboard-cta-buttons {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .dashboard-cta-buttons .btn {
        justify-content: center;
        font-size: 11px !important;
        padding: 8px 4px !important;
    }
}

@media (max-width: 600px) {
    .page-card-grid, .profile-card-grid {
        grid-template-columns: 1fr !important;
    }
}
