/* Mobile First Responsive Design */

/* Base styles */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
}

/* Mobile First - Base styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #212529;
    background-color: #f8f9fa;
}

/* Admin Layout */
.admin-layout {
    padding: 0;
    margin: 0;
}

.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    min-height: 100vh;
}

/* Sidebar Styles - Mobile First */
.sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    transition: all 0.3s ease;
    position: fixed;
    top: 0;
    left: -var(--sidebar-width);
    height: 100vh;
    z-index: 1050;
    overflow-y: auto;
    transform: translateX(0);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Mobile: sidebar hidden by default */
@media (max-width: 767.98px) {
    .sidebar {
        left: -var(--sidebar-width);
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        left: 0;
        transform: translateX(0);
    }
    
    .main {
        margin-left: 0;
        width: 100%;
    }
    
    /* Prevent body scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }
    
    /* Ensure sidebar toggle is always visible on mobile */
    .sidebar-toggle {
        display: block !important;
    }
}

.sidebar-content {
    padding: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 1.25rem 1.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand:hover {
    color: #fff;
    text-decoration: none;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-header {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    margin-top: 1rem;
}

.sidebar-item {
    position: relative;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover,
.sidebar-item.active .sidebar-link {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: #fff;
}

.sidebar-link i {
    width: 20px;
    margin-right: 0.75rem;
    text-align: center;
}

/* Main Content */
.main {
    flex: 1;
    min-height: 100vh;
    transition: all 0.3s ease;
    margin-left: 0;
}

/* Navbar */
.navbar-bg {
    background-color: #fff !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    padding: 0.75rem 1.5rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.125rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0.5rem;
    margin-right: 1rem;
    display: block;
    transition: color 0.2s ease;
}

.sidebar-toggle:hover {
    color: #495057;
}

.hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.hamburger::before {
    content: "☰";
    font-size: 1.25rem;
    line-height: 1;
}

/* Avatar */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

/* Content */
.content {
    padding: 1.5rem;
}

/* Cards */
.card {
    border: 0;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Info Boxes */
.info-box {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.info-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--info-color) 100%);
}

.info-box-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--info-color) 100%);
    color: #fff;
}

.info-box-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.25rem;
}

.info-box-text {
    color: var(--secondary-color);
    font-size: 0.875rem;
    font-weight: 500;
}

/* DataTables Responsive */
.table-responsive {
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Forms */
.form-control,
.form-select {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    padding: 0.5rem 0.75rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Buttons */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--info-color) 100%);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #138496 100%);
}

/* Alerts */
.alert {
    border: 0;
    border-radius: 0.5rem;
    border-left: 4px solid;
}

.alert-success {
    border-left-color: var(--success-color);
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
}

.alert-danger {
    border-left-color: var(--danger-color);
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    overflow: hidden;
    width: 100%;
    max-width: 400px;
    margin: 1rem;
}

.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 2rem 1.5rem 1.5rem;
    text-align: center;
}

.login-body {
    padding: 2rem 1.5rem;
}

/* Tablet and Desktop Styles */
@media (min-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(0);
    }
    
    .main {
        margin-left: var(--sidebar-width);
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .content {
        padding: 2rem;
    }
    
    .info-box {
        display: flex;
        align-items: center;
    }
    
    .info-box-icon {
        margin-right: 1.5rem;
        margin-bottom: 0;
    }
    
    .login-card {
        margin: 0;
    }
}

/* Desktop Styles */
@media (min-width: 992px) {
    .content {
        padding: 2.5rem;
    }
    
    .card-body {
        padding: 2rem;
    }
    
    .info-box {
        padding: 2rem;
    }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .container-fluid {
        max-width: 1400px;
    }
}

/* Utilities */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--info-color) 100%) !important;
}

.text-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--info-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Select2 Customization */
.select2-container--default .select2-selection--single {
    height: calc(1.5em + 1rem + 2px);
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: calc(1.5em + 1rem);
    padding-left: 0.75rem;
}

/* DataTables Customization */
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.375rem 0.75rem;
}

.order-selector .order-color-dot {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Responsive Tables */
@media (max-width: 767.98px) {
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --text-color: #e0e0e0;
        --card-bg: #2d2d2d;
    }
}
