/* Common Layout Styles for All Pages */

.gradient-bg {
    background: linear-gradient(90deg, #1e1e1e 0%, #2a2a2a 100%);
    border-bottom: 3px solid #ff7a1c;
}

/* Header - Always on top */
header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 50;
    height: 70px;
}

/* Ensure header button icons are white */
header button i,
header button .fas,
header button .far,
header button .fab,
header i,
header .fas,
header .far,
header .fab {
    color: white !important;
}

/* Specific fix for paper plane icon */
.fa-paper-plane,
i.fa-paper-plane,
.fas.fa-paper-plane {
    color: white !important;
}

/* Force all Font Awesome icons to be white by default */
.fas, .far, .fab, .fa {
    color: inherit;
}

/* Make sure button text and icons are white */
button.text-white i,
button.text-white .fas,
button.text-white .far {
    color: white !important;
}

/* Sidebar - Below header on desktop */
.sidebar {
    transition: transform 0.3s ease;
    background: #2a2a2a !important;
    border-right: 1px solid #333;
    position: fixed;
    top: 70px;
    left: 0;
    height: calc(100vh - 70px);
    z-index: 20;
    width: 256px;
    overflow-y: auto;
}

.sidebar nav {
    margin-top: 0;
    padding-top: 0;
}

.sidebar a.active {
    background: #ff7a1c;
    color: white;
}

.sidebar a:hover {
    background: #333;
    border-left: 3px solid #ff7a1c;
}

/* Content Area */
.content-area {
    transition: margin-left 0.3s ease;
    min-height: calc(100vh - 70px);
}

/* Main Wrapper */
.main-wrapper {
    padding-top: 70px;
}

/* Scrollbar Styling - Dark Theme */

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #444 #1a1a1a;
}

/* Webkit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
    border: 2px solid #1a1a1a;
}

::-webkit-scrollbar-thumb:hover {
    background: #ff7a1c;
}

::-webkit-scrollbar-thumb:active {
    background: #ff9a4c;
}

/* Scrollbar corner */
::-webkit-scrollbar-corner {
    background: #1a1a1a;
}

/* Primary Color Utilities */
.btn-primary {
    background: #ff7a1c;
}

.btn-primary:hover {
    background: #ff9a4c;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 60;
    background: #ff7a1c;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 20px;
}

.menu-toggle:hover {
    background: #ff9a4c;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

.sidebar-overlay.active {
    display: block;
}

/* Analytics Page Specific */
.chart-container {
    max-height: 500px;
    overflow: hidden;
}

.table-container {
    max-height: 600px;
    overflow-y: auto;
}

/* Modal Utilities */
.modal {
    display: none;
}

.modal.active {
    display: flex;
}

/* Tab Content */
.tab-content {
    display: none;
}

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

/* Tablet and Mobile Responsive */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .sidebar {
        transform: translateX(-100%);
        top: 0;
        height: 100vh;
        z-index: 45;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 5px 0 15px rgba(0, 0, 0, 0.3);
    }

    .content-area {
        margin-left: 0 !important;
        padding: 1rem;
    }

    /* Mobile Header Improvements */
    header {
        padding-left: 60px !important;
        height: auto;
        min-height: 60px;
    }

    header .px-6 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    header .py-4 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }

    header h1 {
        font-size: 1.1rem !important;
    }

    header h1 i {
        font-size: 1rem;
        margin-right: 0.5rem !important;
    }

    /* Make header button container more compact */
    header .flex.items-center.space-x-4 {
        gap: 0.4rem;
    }

    /* Make all header buttons smaller and icon-only */
    header button {
        padding: 0.5rem !important;
        font-size: 0.875rem !important;
        min-width: auto !important;
    }

    /* Hide all button text on mobile, keep only icons */
    header button .fa-paper-plane + *,
    header button .fa-sign-out-alt + * {
        display: none;
    }

    header button i {
        margin: 0 !important;
    }

    /* Hide user info and keyboard shortcut button completely */
    #userInfo,
    button[onclick="showKeyboardShortcutsHelp()"] {
        display: none !important;
    }

    /* Send Email button - slightly larger */
    button[onclick="openQuickSend()"] {
        padding: 0.5rem 0.75rem !important;
    }

    table {
        font-size: 0.875rem;
    }

    .text-3xl {
        font-size: 1.5rem;
    }

    .text-2xl {
        font-size: 1.25rem;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .sidebar {
        width: 85vw;
        max-width: 280px;
    }

    /* Even more compact header for small screens */
    header h1 {
        font-size: 0.9rem !important;
    }

    header h1 .text-orange-400 {
        display: none;
    }

    header h1 i {
        display: none;
    }

    /* Make buttons even smaller */
    header button {
        padding: 0.4rem !important;
        font-size: 0.75rem !important;
    }

    button[onclick="openQuickSend()"] {
        padding: 0.4rem 0.6rem !important;
    }

    .flex.space-x-3,
    .flex.space-x-4 {
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .grid.grid-cols-2,
    .grid.grid-cols-3 {
        grid-template-columns: 1fr;
    }

    .max-w-2xl {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* Analytics adjustments */
    .analytics-grid {
        grid-template-columns: 1fr !important;
    }

    .chart-container {
        max-height: 400px;
    }

    .table-container {
        max-height: 400px;
    }
}

/* Ensure tables are scrollable on mobile */
@media (max-width: 768px) {
    .table-container,
    .overflow-x-auto {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }
}
