/* Crown-Dash Styles - Matching Original Design */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-blue: #0066cc;
    --dark-blue: #003d7a;
    --light-blue: #e6f3ff;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--light-blue) 100%);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    height: 100vh;
    padding: 0;
    box-shadow: var(--shadow-lg);
    position: fixed;
    left: 0;
    top: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    width: 250px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-blue), var(--accent-green));
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar.collapsed .logo-full {
    display: none !important;
}

.sidebar-header {
    padding: 1rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-50) 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: none;
    background: transparent;
    color: var(--gray-500);
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar-toggle:hover {
    background: var(--gray-100);
    color: var(--primary-blue);
}

.sidebar .nav {
    padding: 0.5rem 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.sidebar .nav-link {
    color: var(--gray-600);
    padding: 0.75rem 1rem;
    border-radius: 0;
    margin: 0;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.sidebar .nav-link i {
    width: 20px;
    margin-right: 0.75rem;
    font-size: 1rem;
}

.sidebar .nav-link:hover {
    background: var(--gray-50);
    color: var(--primary-blue);
    border-left-color: var(--gray-300);
}

.sidebar .nav-link.active {
    background: var(--light-blue);
    color: var(--primary-blue);
    border-left-color: var(--primary-blue);
    font-weight: 600;
}

.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
    flex-shrink: 0;
    max-height: 180px;
    overflow-y: auto;
}

/* Main Content */
.main-content {
    margin-left: 250px;
    transition: margin-left 0.3s ease;
    padding: 2rem;
    width: calc(100% - 250px);
    min-height: 100vh;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 70px;
    width: calc(100% - 70px);
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.header-title {
    color: var(--gray-900);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
}

.header-subtitle {
    color: var(--gray-600);
    font-size: 1rem;
    font-weight: 400;
}

/* Dashboard Cards */
.dashboard-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    transition: all 0.3s ease;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.dashboard-card:hover {
    box-shadow: var(--shadow-lg);
}

.dashboard-card .card-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1.5rem;
}

.dashboard-card .card-header h5 {
    color: var(--gray-800);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
}

.dashboard-card .card-header h5 i {
    color: var(--primary-blue);
    margin-right: 0.5rem;
}

.dashboard-card .card-body {
    padding: 1.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Stats Cards */
.stats-card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.stats-card.primary::before { background: var(--primary-blue); }
.stats-card.success::before { background: var(--accent-green); }
.stats-card.warning::before { background: var(--accent-orange); }
.stats-card.danger::before { background: var(--accent-red); }
.stats-card.info::before { background: #0dcaf0; }

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stats-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.stats-card.primary .stats-card-icon { background: var(--light-blue); color: var(--primary-blue); }
.stats-card.success .stats-card-icon { background: #ecfdf5; color: var(--accent-green); }
.stats-card.warning .stats-card-icon { background: #fffbeb; color: var(--accent-orange); }
.stats-card.danger .stats-card-icon { background: #fef2f2; color: var(--accent-red); }

.stats-card h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
    letter-spacing: -0.025em;
}

.stats-card p {
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
}

.stats-card .trend {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
    color: var(--gray-500);
}

.trend.up { color: var(--accent-green); }
.trend.down { color: var(--accent-red); }

/* Page Content */
.page-content {
    display: none;
}

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

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

/* Tables */
.table {
    margin: 0;
    font-size: 0.875rem;
}

.table thead th {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
    font-weight: 600;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-800);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

/* Filters Panel */
.filters-panel {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

/* Form Controls */
.form-control, .form-select {
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgb(0 102 204 / 0.1);
    outline: none;
}

/* Buttons */
.btn-primary {
    background: var(--primary-blue);
    border: 1px solid var(--primary-blue);
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--dark-blue);
    border-color: var(--dark-blue);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Refresh button animation */
.refreshing .fa-sync-alt {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Sales Desk Table Compact */
#salesDeskCard table {
    font-size: 0.75rem;
}

#salesDeskCard table th,
#salesDeskCard table td {
    padding: 0.4rem 0.5rem;
}

/* Card styles */
.card {
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }

    .sidebar .nav-text {
        display: none;
    }

    .main-content {
        margin-left: 70px;
        width: calc(100% - 70px);
    }

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

/* Print */
@media print {
    .sidebar, .sidebar-footer, .loading-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }
}
