/**
 * GT-Scolarix - Main Stylesheet
 * Système de gestion scolaire
 */

/* ========================================
   CSS Variables
   ======================================== */

:root {
    /* Colors */
    --gt-primary: #0d6efd;
    --gt-primary-dark: #0a58ca;
    --gt-secondary: #6c757d;
    --gt-success: #198754;
    --gt-info: #0dcaf0;
    --gt-warning: #ffc107;
    --gt-danger: #dc3545;
    --gt-light: #f8f9fa;
    --gt-dark: #212529;

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

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

    /* Shadows */
    --gt-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --gt-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --gt-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);

    /* Borders */
    --gt-border-radius: 0.375rem;
    --gt-border-radius-lg: 0.5rem;
    --gt-border-color: #dee2e6;

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

/* ========================================
   Base Styles
   ======================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

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-dark);
    background-color: #f4f6f9;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   Typography
   ======================================== */

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

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

p {
    margin-bottom: 1rem;
}

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

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

/* ========================================
   Cards
   ======================================== */

.card {
    border: none;
    border-radius: var(--gt-border-radius-lg);
    box-shadow: var(--gt-shadow-sm);
    background: #fff;
    transition: var(--gt-transition-base);
}

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

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

.card-body {
    padding: 1.25rem;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--gt-border-color);
    padding: 1rem 1.25rem;
}

/* ========================================
   Tables
   ======================================== */

.table {
    font-size: 0.875rem;
}

.table th {
    font-weight: 600;
    color: var(--gt-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom-width: 1px;
}

.table-hover tbody tr {
    cursor: pointer;
    transition: var(--gt-transition-base);
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

.table-responsive {
    border-radius: var(--gt-border-radius);
}

/* ========================================
   Forms
   ======================================== */

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

.form-control,
.form-select {
    border-radius: var(--gt-border-radius);
    border-color: var(--gt-border-color);
    padding: 0.5rem 0.875rem;
    font-size: 0.9375rem;
    transition: var(--gt-transition-base);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--gt-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.form-control:disabled,
.form-select:disabled {
    background-color: #f8f9fa;
    opacity: 1;
}

.form-text {
    font-size: 0.8125rem;
    color: var(--gt-secondary);
}

.input-group-text {
    border-color: var(--gt-border-color);
    background-color: #f8f9fa;
}

.form-check-input:checked {
    background-color: var(--gt-primary);
    border-color: var(--gt-primary);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--gt-border-radius);
    transition: var(--gt-transition-base);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

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

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

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

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
}

/* ========================================
   Badges
   ======================================== */

.badge {
    font-weight: 500;
    padding: 0.4em 0.65em;
    border-radius: var(--gt-border-radius);
}

.badge-pill {
    border-radius: 10rem;
}

/* Status badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ========================================
   Alerts
   ======================================== */

.alert {
    border: none;
    border-radius: var(--gt-border-radius);
    padding: 1rem 1.25rem;
}

.alert-dismissible .btn-close {
    padding: 1.25rem 1rem;
}

/* ========================================
   Dropdowns
   ======================================== */

.dropdown-menu {
    border: none;
    border-radius: var(--gt-border-radius);
    box-shadow: var(--gt-shadow);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: var(--gt-border-radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: var(--gt-transition-base);
}

.dropdown-item:hover {
    background-color: var(--gt-light);
}

.dropdown-item.active {
    background-color: var(--gt-primary);
}

.dropdown-divider {
    margin: 0.5rem 0;
}

.dropdown-header {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gt-secondary);
    padding: 0.5rem 0.75rem;
}

/* ========================================
   Modals
   ======================================== */

.modal-content {
    border: none;
    border-radius: var(--gt-border-radius-lg);
    box-shadow: var(--gt-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--gt-border-color);
    padding: 1rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--gt-border-color);
    padding: 1rem 1.5rem;
}

/* ========================================
   Pagination
   ======================================== */

.pagination {
    gap: 0.25rem;
}

.page-link {
    border: 1px solid var(--gt-border-color);
    border-radius: var(--gt-border-radius);
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    color: var(--gt-dark);
    transition: var(--gt-transition-base);
}

.page-link:hover {
    background-color: var(--gt-light);
    border-color: var(--gt-border-color);
    color: var(--gt-primary);
}

.page-item.active .page-link {
    background-color: var(--gt-primary);
    border-color: var(--gt-primary);
}

.page-item.disabled .page-link {
    background-color: #fff;
    color: var(--gt-secondary);
}

/* ========================================
   Tabs
   ======================================== */

.nav-tabs {
    border-bottom: 2px solid var(--gt-border-color);
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--gt-secondary);
    font-weight: 500;
    padding: 0.75rem 1rem;
    transition: var(--gt-transition-base);
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
    color: var(--gt-primary);
}

.nav-tabs .nav-link.active {
    color: var(--gt-primary);
    border-bottom-color: var(--gt-primary);
}

/* ========================================
   Progress Bars
   ======================================== */

.progress {
    height: 0.5rem;
    border-radius: 10rem;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 10rem;
}

/* ========================================
   Tooltips & Popovers
   ======================================== */

.tooltip {
    font-size: 0.8125rem;
}

.tooltip-inner {
    border-radius: var(--gt-border-radius);
    padding: 0.375rem 0.75rem;
}

/* ========================================
   Utilities
   ======================================== */

/* Spacing */
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }

/* Text */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Cursor */
.cursor-pointer { cursor: pointer !important; }
.cursor-default { cursor: default !important; }

/* Hover effects */
.hover-lift {
    transition: transform 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
}

.hover-shadow {
    transition: box-shadow 0.2s ease;
}

.hover-shadow:hover {
    box-shadow: var(--gt-shadow);
}

/* ========================================
   Animations
   ======================================== */

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

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

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

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

.animate-slide-up {
    animation: slideUp 0.3s ease-in-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* ========================================
   RTL Support
   ======================================== */

[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .me-1, [dir="rtl"] .me-2, [dir="rtl"] .me-3, [dir="rtl"] .me-4 {
    margin-right: 0 !important;
}

[dir="rtl"] .ms-1, [dir="rtl"] .ms-2, [dir="rtl"] .ms-3, [dir="rtl"] .ms-4 {
    margin-left: 0 !important;
}

[dir="rtl"] .me-1 { margin-left: 0.25rem !important; }
[dir="rtl"] .me-2 { margin-left: 0.5rem !important; }
[dir="rtl"] .me-3 { margin-left: 1rem !important; }
[dir="rtl"] .me-4 { margin-left: 1.5rem !important; }

[dir="rtl"] .ms-1 { margin-right: 0.25rem !important; }
[dir="rtl"] .ms-2 { margin-right: 0.5rem !important; }
[dir="rtl"] .ms-3 { margin-right: 1rem !important; }
[dir="rtl"] .ms-4 { margin-right: 1.5rem !important; }

[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: var(--gt-sidebar-width);
}

/* ========================================
   Layout - Main Content Area
   ======================================== */

.wrapper {
    min-height: 100vh;
    position: relative;
}

.main-content {
    margin-left: var(--gt-sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
    overflow-x: hidden;
}

.content-wrapper {
    flex-grow: 1;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* Ensure container-fluid doesn't overflow */
.main-content .container-fluid {
    max-width: 100%;
    overflow-x: hidden;
}

/* Table responsive fix */
.main-content .table-responsive {
    max-width: 100%;
    overflow-x: auto;
}

/* Responsive sidebar adjustments */
@media (max-width: 991.98px) {
    .main-content {
        margin-left: 0;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .sidebar,
    .main-header,
    .main-footer,
    .no-print {
        display: none !important;
    }

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

    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }

    .btn {
        display: none;
    }

    a {
        text-decoration: none;
        color: inherit;
    }

    body {
        font-size: 12pt;
        background: #fff;
    }
}
