/* frontend/css/styles.css */

/* ========================================
   VARIABLES CSS
======================================== */
:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --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;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    
    --transition: all 0.3s ease;
}

/* ========================================
   RESET & BASE
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: 1rem;
}

/* ========================================
   PAGE DE CONNEXION
======================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--gray-600);
    font-size: 1rem;
}

/* ========================================
   HEADER
======================================== */
.header {
    background: white;
    box-shadow: var(--shadow);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.username {
    font-weight: 600;
    color: var(--gray-700);
}

/* ========================================
   NAVIGATION
======================================== */
.nav {
    background: white;
    box-shadow: var(--shadow);
    padding: 0 2rem;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
}

.nav-link {
    padding: 1rem 1.5rem;
    color: var(--gray-600);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
    font-weight: 500;
}

.nav-link:hover {
    color: var(--primary);
    background: var(--gray-50);
}

.nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ========================================
   MAIN CONTENT
======================================== */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ========================================
   CARDS
======================================== */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-100);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* ========================================
   STATS CARDS
======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card.success {
    border-left: 4px solid var(--success);
}

.stat-card.danger {
    border-left: 4px solid var(--danger);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* ========================================
   BUTTONS
======================================== */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* ========================================
   FORMS
======================================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ========================================
   TABLES
======================================== */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    background: var(--gray-50);
    font-weight: 700;
    color: var(--gray-700);
    font-size: 0.875rem;
    text-transform: uppercase;
}

tr:hover {
    background: var(--gray-50);
}

/* ========================================
   BADGES
======================================== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* ========================================
   ALERTS
======================================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

/* ========================================
   MODAL
======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 2px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ========================================
   UTILITIES
======================================== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-muted {
    color: var(--gray-500);
}

.mt-3 {
    margin-top: 1rem;
}

.loading {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   DETTE PARENTS
======================================== */
.dette-container {
    text-align: center;
    padding: 3rem 1rem;
}

.dette-value {
    font-size: 3.5rem;
    font-weight: 700;
    margin: 1rem 0;
}

.dette-description {
    font-size: 1.125rem;
    color: var(--gray-600);
    margin-bottom: 2rem;
}

.chart-container {
    position: relative;
    height: 400px;
    margin: 2rem 0;
}
