:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --radius: 0.5rem;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--background-color);
    color: var(--text-main);
    line-height: 1.5;
}

/* Utilities */
.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.h-screen {
    height: 100vh;
}

.w-full {
    width: 100%;
}

.text-center {
    text-align: center;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

/* Auth Layout */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
}

.auth-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-subtitle {
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s;
    border: none;
    text-decoration: none;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-block {
    display: block;
    width: 100%;
}

.alert {
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
}

.nav-links {
    flex: 1;
    padding: 1rem;
    list-style: none;
}

.nav-links li {
    margin-bottom: 0.5rem;
}

.nav-links a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s;
    font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
    background-color: #eff6ff;
    color: var(--primary-color);
}

.nav-links a.active {
    background-color: #eff6ff;
    color: var(--primary-color);
}

.main-content {
    flex: 1;
    padding: 2rem;
    background-color: var(--background-color);
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Tables */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f9fafb;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-en_cours {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-a_payer {
    background-color: #fce7f3;
    color: #9d174d;
}

.badge-paye {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-abandonne {
    background-color: #f3f4f6;
    color: #374151;
}

@media (max-width: 1024px) {
    .dashboard-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-header {
        padding: 1rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .main-content {
        padding: 1rem;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .card {
        padding: 1rem !important;
    }

    /* Card View for Tables on Mobile */
    thead {
        display: none;
    }

    tr {
        display: block;
        margin-bottom: 1rem;
        background: white;
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }

    td {
        display: block;
        text-align: right;
        padding: 0.75rem 1rem;
        position: relative;
        border-bottom: 1px solid #f1f5f9;
    }

    td:last-child {
        border-bottom: none;
        padding-top: 1rem;
        padding-bottom: 1rem;
        background-color: #f8fafc;
        text-align: center;
        /* Center buttons */
    }

    /* Add labels via data-attribute */
    td::before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: 45%;
        text-align: left;
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
    }

    /* Stack buttons nicely */
    td .btn {
        display: inline-block;
        width: auto;
        min-width: 100px;
        /* Ensure buttons have clickable area */
        margin: 0.25rem;
        padding: 0.5rem 1rem;
        text-align: center;
    }
}