/* ========================================
   MODERN Air IT Group Charger App THEME
   ======================================== */

/* CSS VARIABLES - Design Tokens */
:root {
    /* Brand Colors */
    --primary: #03054d;
    --primary-light: #0a0b7a;
    --primary-dark: #020338;
    --secondary: #def2fa;
    --accent-blue: #08c1f9;
    --accent-orange: #ff611a;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #03054d 0%, #0a0b7a 100%);
    --gradient-accent: linear-gradient(135deg, #08c1f9 0%, #0891c9 100%);
    --gradient-orange: linear-gradient(135deg, #ff611a 0%, #e65618 100%);
    --gradient-background: linear-gradient(135deg, #def2fa 0%, #b8e6f7 100%);

    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Semantic Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-glow: 0 0 20px rgb(8 193 249 / 0.3);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   GLOBAL STYLES
   ======================================== */

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

body {
    font-family: var(--font-sans);
    background: var(--gradient-background);
    color: var(--gray-800);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* Improved Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--primary);
    margin-bottom: var(--space-md);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

p {
    margin-bottom: var(--space-md);
    color: var(--gray-600);
}

/* ========================================
   MODERN CARDS
   ======================================== */

.card {
    background: var(--white);
    border-radius: var(--radius-xl);
    border: none;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: all var(--transition-base);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-accent);
}

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

.card-header {
    background: var(--gradient-primary);
    color: var(--white);
    padding: var(--space-lg);
    font-size: 1.5rem;
    font-weight: 700;
    border: none;
    position: relative;
    overflow: hidden;
}

.card-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.card-body {
    padding: var(--space-xl);
}

/* Glass Effect Cards */
.glass-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ========================================
   MODERN BUTTONS
   ======================================== */

.btn {
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    text-decoration: none;
    box-shadow: var(--shadow);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width var(--transition-base), height var(--transition-base);
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-orange);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(255, 97, 26, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 97, 26, 0.4);
    color: var(--white);
}

.btn-secondary {
    background: var(--gradient-accent);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(8, 193, 249, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(8, 193, 249, 0.4);
    color: var(--white);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading Button State */
.btn-loading {
    pointer-events: none;
    position: relative;
    color: transparent;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* ========================================
   OFFICE CARDS (Dashboard)
   ======================================== */

#office-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
    margin-top: var(--space-xl);
}

.office {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    text-align: center;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.office::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--gradient-accent);
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.office:hover::before {
    transform: scaleX(1);
}

.office:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent-blue);
}

.office h3 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
    font-weight: 700;
}

.office p {
    color: var(--gray-500);
    font-size: 1.1rem;
    margin: 0;
}

.office-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto var(--space-md);
    background: var(--gradient-accent);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
    box-shadow: var(--shadow-glow);
}

/* ========================================
   ALERTS & STATUS CARDS
   ======================================== */

.alert {
    border-radius: var(--radius-lg);
    border: none;
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow);
    animation: slideDown 0.3s ease-out;
}

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

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-left: 4px solid var(--success);
}

.alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-left: 4px solid var(--info);
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid var(--warning);
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-left: 4px solid var(--error);
}

.alert-heading {
    font-weight: 700;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* ========================================
   TABLES
   ======================================== */

.table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.table thead {
    background: var(--gradient-primary);
    color: var(--white);
}

.table thead th {
    padding: var(--space-lg);
    font-weight: 600;
    text-align: left;
    border: none;
}

.table tbody td {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition-fast);
}

.table tbody tr {
    transition: all var(--transition-fast);
}

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

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   FORMS & INPUTS
   ======================================== */

.form-label {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--space-xs);
    display: block;
}

.form-control {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    border: 2px solid var(--gray-200);
    font-size: 1rem;
    transition: all var(--transition-base);
    width: 100%;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(8, 193, 249, 0.1);
}

.form-control:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

/* ========================================
   SIDEBAR
   ======================================== */

#sidebar {
    min-height: 100vh;
    background: var(--gradient-primary);
    color: var(--white);
    box-shadow: var(--shadow-xl);
    position: sticky;
    top: 0;
    padding: var(--space-xl);
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-2xl);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--white);
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-accent);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

#sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius);
    transition: all var(--transition-base);
    margin-bottom: var(--space-xs);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 500;
}

#sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    transform: translateX(5px);
}

#sidebar .nav-link.active {
    background: var(--accent-orange);
    color: var(--white);
    box-shadow: 0 4px 10px rgba(255, 97, 26, 0.3);
}

/* ========================================
   MAIN CONTENT AREA
   ======================================== */

main {
    padding: var(--space-2xl);
    background: transparent;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-lg);
    border-bottom: 2px solid var(--gray-200);
}

.page-header h1 {
    margin: 0;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========================================
   MODALS
   ======================================== */

.modal-content {
    border-radius: var(--radius-xl);
    border: none;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.modal-header {
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    padding: var(--space-xl);
}

.modal-title {
    font-weight: 700;
}

.modal-body {
    padding: var(--space-xl);
}

.modal-footer {
    border-top: 1px solid var(--gray-200);
    padding: var(--space-lg) var(--space-xl);
}

/* ========================================
   BADGES & LABELS
   ======================================== */

.badge {
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.badge-primary {
    background: var(--gradient-primary);
    color: var(--white);
}

.badge-success {
    background: var(--success);
    color: var(--white);
}

.badge-info {
    background: var(--info);
    color: var(--white);
}

.badge-warning {
    background: var(--warning);
    color: var(--white);
}

/* ========================================
   UTILITIES
   ======================================== */

.text-gradient {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-glow {
    box-shadow: var(--shadow-glow);
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }

    main {
        padding: var(--space-lg);
    }

    #office-list {
        grid-template-columns: 1fr;
    }

    .card-body {
        padding: var(--space-lg);
    }
}

/* ========================================
   LOADING STATES
   ======================================== */

.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: var(--radius);
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-accent);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
}

/* ========================================
   MOBILE STYLES
   ======================================== */

/* Mobile Header with Burger Menu */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    padding: 0 var(--space-lg);
    z-index: 1040;
    box-shadow: var(--shadow-lg);
}

.burger-menu {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-xs);
    transition: transform var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
}

.burger-menu:hover {
    background: rgba(255, 255, 255, 0.1);
}

.burger-menu:active {
    transform: scale(0.95);
}

.mobile-brand {
    margin-left: var(--space-md);
    color: var(--white);
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1039;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

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

/* Mobile Responsive Styles */
@media (max-width: 767px) {
    /* Adjust body for fixed mobile header */
    body {
        padding-top: 60px;
    }

    /* Sidebar mobile styles */
    #sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        width: 280px;
        z-index: 1041;
        transition: left var(--transition-base);
        overflow-y: auto;
        box-shadow: var(--shadow-xl);
    }

    #sidebar.show {
        left: 0;
    }

    /* Main content adjustments */
    main {
        padding: var(--space-md) !important;
        margin-left: 0 !important;
    }

    /* Page header mobile */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    /* Card adjustments */
    .card-body {
        padding: var(--space-md);
    }

    .card-header {
        padding: var(--space-md);
        font-size: 1.25rem;
    }

    /* Button groups */
    #actions-container {
        flex-direction: column;
    }

    #actions-container .btn {
        width: 100%;
    }

    /* Tables - Responsive Card Layout */
    .table-responsive-mobile {
        display: block;
    }

    .table thead {
        display: none;
    }

    .table tbody {
        display: block;
    }

    .table tbody tr {
        display: block;
        margin-bottom: var(--space-md);
        background: var(--gray-50);
        border-radius: var(--radius-lg);
        padding: var(--space-md);
        box-shadow: var(--shadow);
    }

    .table tbody tr:hover {
        transform: none;
    }

    .table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: var(--space-sm) 0;
        border: none;
        border-bottom: 1px solid var(--gray-200);
    }

    .table tbody td:last-child {
        border-bottom: none;
    }

    .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--gray-700);
        flex-shrink: 0;
        margin-right: var(--space-md);
    }

    /* Empty state messages on mobile */
    .table tbody td[colspan] {
        display: block;
        text-align: center;
        justify-content: center;
    }

    .table tbody td[colspan]::before {
        display: none;
    }

    /* Office cards grid */
    #office-list {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .office {
        padding: var(--space-lg);
    }

    .office h3 {
        font-size: 1.25rem;
    }

    /* Modal adjustments */
    .modal-dialog {
        margin: var(--space-md);
    }

    /* Alert spacing */
    .alert {
        padding: var(--space-md);
        margin-bottom: var(--space-md);
    }

    /* Typography adjustments */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    /* Form adjustments */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Prevent body scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }
}

/* Tablet specific adjustments */
@media (min-width: 768px) and (max-width: 991px) {
    main {
        padding: var(--space-lg) !important;
    }

    #office-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .table {
        font-size: 0.9rem;
    }
}

/* Small mobile phones */
@media (max-width: 375px) {
    .mobile-brand span {
        font-size: 0.9rem;
    }

    .btn {
        padding: var(--space-xs) var(--space-md);
        font-size: 0.875rem;
    }

    .card-header {
        font-size: 1.1rem;
    }

    h1 {
        font-size: 1.75rem;
    }
}

/* Landscape mobile mode */
@media (max-width: 767px) and (orientation: landscape) {
    #sidebar {
        width: 240px;
    }

    main {
        padding: var(--space-sm) !important;
    }
}

/* Touch-friendly improvements for all mobile devices */
@media (hover: none) and (pointer: coarse) {
    /* Increase tap targets */
    .btn {
        min-height: 44px;
        padding: var(--space-sm) var(--space-lg);
    }

    .nav-link {
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    /* Remove hover effects on touch devices */
    .card:hover {
        transform: none;
    }

    .office:hover {
        transform: none;
    }

    /* Improve button feedback */
    .btn:active {
        transform: scale(0.97);
    }
}
