/**
 * GT-ERP - Styles personnalisés
 * Giga Technologie SARL
 *
 * Thème bleu marine professionnel basé sur Bootstrap 5
 */

/* =============================================================================
   CSS VARIABLES - DESIGN TOKENS
   ============================================================================= */

:root {
    /* Couleurs principales - Bleu Marine */
    --gt-primary: #1E3A8A;
    --gt-primary-hover: #1E40AF;
    --gt-primary-light: #3B82F6;
    --gt-primary-lighter: #60A5FA;
    --gt-primary-dark: #1E3A5F;

    /* Couleurs secondaires */
    --gt-secondary: #64748B;
    --gt-success: #10B981;
    --gt-warning: #F59E0B;
    --gt-danger: #EF4444;
    --gt-info: #3B82F6;

    /* Neutres */
    --gt-white: #FFFFFF;
    --gt-light: #F9FAFB;
    --gt-gray-100: #F3F4F6;
    --gt-gray-200: #E5E7EB;
    --gt-gray-300: #D1D5DB;
    --gt-gray-400: #9CA3AF;
    --gt-gray-500: #6B7280;
    --gt-gray-600: #4B5563;
    --gt-gray-700: #374151;
    --gt-gray-800: #1F2937;
    --gt-dark: #111827;

    /* Typographie */
    --gt-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --gt-font-size-base: 0.9375rem;
    --gt-line-height-base: 1.5;

    /* Espacements */
    --gt-sidebar-width: 260px;
    --gt-sidebar-collapsed-width: 70px;
    --gt-header-height: 60px;

    /* Transitions */
    --gt-transition: all 0.2s ease-in-out;

    /* Ombres */
    --gt-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --gt-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --gt-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Bordures */
    --gt-border-radius: 0.5rem;
    --gt-border-color: #E5E7EB;
}

/* =============================================================================
   BASE STYLES
   ============================================================================= */

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--gt-font-family);
    font-size: var(--gt-font-size-base);
    line-height: var(--gt-line-height-base);
    color: var(--gt-gray-800);
    background-color: var(--gt-light);
}

/* =============================================================================
   BOOTSTRAP OVERRIDES
   ============================================================================= */

/* Primary Color Override */
.btn-primary {
    background-color: var(--gt-primary);
    border-color: var(--gt-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--gt-primary-hover);
    border-color: var(--gt-primary-hover);
}

.btn-outline-primary {
    color: var(--gt-primary);
    border-color: var(--gt-primary);
}

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

.text-primary {
    color: var(--gt-primary) !important;
}

.bg-primary {
    background-color: var(--gt-primary) !important;
}

.border-primary {
    border-color: var(--gt-primary) !important;
}

/* Links */
a {
    color: var(--gt-primary);
    text-decoration: none;
    transition: var(--gt-transition);
}

a:hover {
    color: var(--gt-primary-hover);
}

/* Cards */
.card {
    border: 1px solid var(--gt-border-color);
    border-radius: var(--gt-border-radius);
    box-shadow: var(--gt-shadow-sm);
}

.card-header {
    background-color: var(--gt-white);
    border-bottom: 1px solid var(--gt-border-color);
    padding: 1rem 1.25rem;
}

.card-title {
    font-weight: 600;
    color: var(--gt-gray-800);
    margin-bottom: 0;
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--gt-primary-light);
    box-shadow: 0 0 0 0.2rem rgba(30, 58, 138, 0.15);
}

.form-label {
    font-weight: 500;
    color: var(--gt-gray-700);
    margin-bottom: 0.375rem;
}

/* Tables */
.table > thead {
    background-color: var(--gt-gray-100);
}

.table > thead > tr > th {
    font-weight: 600;
    color: var(--gt-gray-700);
    border-bottom-width: 1px;
    padding: 0.875rem 1rem;
}

.table > tbody > tr > td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
}

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

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* =============================================================================
   LAYOUT - APP STRUCTURE
   ============================================================================= */

.app-wrapper {
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    width: var(--gt-sidebar-width);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1040;
    transition: var(--gt-transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.75);
    padding: 0.625rem 1rem;
    border-radius: 0.375rem;
    margin: 0.125rem 0.75rem;
    transition: var(--gt-transition);
}

.app-sidebar .nav-link:hover {
    color: var(--gt-white);
    background-color: rgba(255, 255, 255, 0.1);
}

.app-sidebar .nav-link.active {
    color: var(--gt-white);
    background-color: var(--gt-primary);
}

.app-sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background-color: transparent;
}

/* Sidebar header et footer fixes */
.sidebar-header {
    flex: 0 0 auto;
}

.sidebar-footer {
    flex: 0 0 auto;
}

/* Titres de section dans le sidebar */
.app-sidebar .nav-link.text-muted,
.app-sidebar .text-muted {
    color: rgba(255, 255, 255, 0.5) !important;
}

.app-sidebar .nav-link.text-uppercase {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding-top: 0.75rem;
    padding-bottom: 0.25rem;
}

/* Main Content */
.app-main {
    margin-left: var(--gt-sidebar-width);
    min-height: 100vh;
    transition: var(--gt-transition);
}

/* Header */
.app-header {
    height: var(--gt-header-height);
    z-index: 1030;
}

.app-header .navbar {
    height: 100%;
}

/* Content Area */
.app-content {
    background-color: var(--gt-light);
}

/* Footer */
.app-footer {
    margin-top: auto;
}

/* =============================================================================
   AUTH LAYOUT
   ============================================================================= */

.auth-layout {
    background-color: var(--gt-light);
}

.auth-branding {
    flex: 0 0 45%;
    max-width: 45%;
}

.auth-form-container {
    background-color: var(--gt-white);
}

/* =============================================================================
   COMPONENTS
   ============================================================================= */

/* Page Header */
.page-actions .btn {
    margin-left: 0.5rem;
}

/* Stats Cards / KPI Widgets */
.stat-card {
    border: none;
    border-radius: var(--gt-border-radius);
    transition: var(--gt-transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--gt-shadow-lg);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gt-gray-800);
}

.stat-card .stat-label {
    color: var(--gt-gray-500);
    font-size: 0.875rem;
}

.stat-card .stat-trend {
    font-size: 0.8125rem;
}

.stat-card .stat-trend.up {
    color: var(--gt-success);
}

.stat-card .stat-trend.down {
    color: var(--gt-danger);
}

/* Empty State */
.empty-state {
    padding: 3rem 1rem;
}

.empty-state-icon {
    opacity: 0.5;
}

/* Data Tables */
.data-table {
    background-color: var(--gt-white);
    border-radius: var(--gt-border-radius);
    overflow: hidden;
}

.data-table .table {
    margin-bottom: 0;
}

/* Action Buttons */
.btn-icon {
    padding: 0.375rem 0.5rem;
    line-height: 1;
}

.action-buttons .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Status Badges */
.badge-status {
    font-size: 0.75rem;
    padding: 0.375rem 0.625rem;
    border-radius: 9999px;
}

/* Search Box */
#globalSearch {
    border-radius: 0;
}

#globalSearch:focus {
    box-shadow: none;
}

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

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0;
    }

    .auth-branding {
        display: none !important;
    }
}

@media (max-width: 575.98px) {
    .page-actions {
        width: 100%;
        margin-top: 1rem;
    }

    .page-actions .btn {
        width: 100%;
        margin-left: 0;
        margin-bottom: 0.5rem;
    }
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */

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

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

/* HTMX Loading Indicator */
.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-indicator {
    display: none;
}

/* =============================================================================
   PRINT STYLES
   ============================================================================= */

@media print {
    .app-sidebar,
    .app-header,
    .app-footer,
    .page-actions,
    .btn {
        display: none !important;
    }

    .app-main {
        margin-left: 0 !important;
    }

    .app-content {
        padding: 0 !important;
    }

    .card {
        border: none !important;
        box-shadow: none !important;
    }
}
