:root {
    --bg-color: #21406B;
    /* Dark Blue */
    --card-bg: rgba(33, 64, 107, 0.4);
    --text-primary: #F8F0E5;
    /* Light Beige */
    --text-secondary: #E7D4BD;
    /* Beige */
    --accent-color: #E7D4BD;
    /* Beige Accent */
    --accent-glow: rgba(231, 212, 189, 0.3);
    --input-bg: rgba(60, 100, 173, 0.3);
    --border-color: rgba(231, 212, 189, 0.15);
    --danger-color: #ef4444;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 10s infinite;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #3C64AD;
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: #E7D4BD;
    bottom: -50px;
    right: -50px;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: #F8F0E5;
    top: 40%;
    left: 40%;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, -30px);
    }
}

.container.wide {
    width: 100%;
    max-width: 1000px;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.accent {
    background: linear-gradient(135deg, #E7D4BD, #F8F0E5);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Controls */
.controls-area {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.input-group.small {
    width: 200px;
}

label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

input[type="number"],
select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem;
    color: var(--text-primary);
    font-family: inherit;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.global-info {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.badge-lg {
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.badge-lg.success {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border-color: #059669;
}

/* Rank Badges */
.rank-bronze {
    background: linear-gradient(135deg, rgba(180, 83, 9, 0.2), rgba(217, 119, 6, 0.2));
    color: #fbbf24;
    border-color: #b45309;
}

.rank-silver {
    background: linear-gradient(135deg, rgba(71, 85, 105, 0.2), rgba(148, 163, 184, 0.2));
    color: #e2e8f0;
    border-color: #94a3b8;
    box-shadow: 0 0 15px rgba(148, 163, 184, 0.1);
}

.rank-gold {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(250, 204, 21, 0.2));
    color: #fde047;
    border-color: #eab308;
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.3);
    border: 1px solid rgba(253, 224, 71, 0.5);
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

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

.users-input,
.duration-input {
    width: 100px !important;
}

.ca-cell {
    font-family: monospace;
    font-size: 1.1rem;
}

.comm-cell {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 700;
    font-weight: 700;
    color: var(--text-secondary);
}

.actions {
    display: flex;
    gap: 1rem;
}

.btn-primary {
    background: var(--accent-color);
    color: var(--bg-color);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(231, 212, 189, 0.1);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

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

/* Tablettes (max 768px) */
@media screen and (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .glass-card {
        padding: 1.25rem;
        border-radius: 16px;
    }

    h1 {
        font-size: 1.6rem;
    }

    header p {
        font-size: 0.85rem;
    }

    /* Controls en colonne */
    .controls-area {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .input-group.small {
        width: 100%;
    }

    .global-info {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }

    .badge-lg {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    /* Boutons */
    .actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1rem;
    }

    /* Réduire les blobs */
    .blob-1 {
        width: 250px;
        height: 250px;
    }

    .blob-2 {
        width: 180px;
        height: 180px;
    }
}

/* Mobile - Transformation en cartes (max 600px) */
@media screen and (max-width: 600px) {
    body {
        padding: 0.75rem;
    }

    .glass-card {
        padding: 1rem;
        border-radius: 14px;
    }

    h1 {
        font-size: 1.4rem;
    }

    header {
        margin-bottom: 1.25rem;
    }

    header p {
        font-size: 0.8rem;
    }

    .controls-area {
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }

    .badge-lg {
        padding: 0.65rem 0.9rem;
        font-size: 0.85rem;
        border-radius: 10px;
    }

    /* ===== TABLEAU EN CARTES ===== */
    .table-container {
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    table {
        display: block;
        min-width: unset;
        width: 100%;
    }

    thead {
        display: none;
    }

    tbody {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    tr {
        display: flex;
        flex-direction: column;
        background: rgba(60, 100, 173, 0.2);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        padding: 1rem;
        gap: 0.75rem;
        position: relative;
    }

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

    td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0;
        border: none;
        gap: 0.5rem;
    }

    /* Pseudo-labels pour chaque cellule */
    td::before {
        content: attr(data-label);
        font-size: 0.75rem;
        font-weight: 500;
        color: var(--text-secondary);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        flex-shrink: 0;
    }

    /* Client ID en header de carte */
    td.client-id {
        background: rgba(231, 212, 189, 0.1);
        margin: -1rem -1rem 0 -1rem;
        padding: 0.75rem 1rem;
        border-radius: 12px 12px 0 0;
        font-weight: 600;
        font-size: 1rem;
        color: var(--accent-color);
    }

    td.client-id::before {
        content: "Client #";
        font-size: 0.85rem;
    }

    /* Inputs ajustés */
    .users-input,
    .duration-input {
        width: 100% !important;
        max-width: 150px;
        font-size: 0.9rem;
        padding: 0.5rem;
        text-align: right;
    }

    /* Cellules de valeurs */
    .ca-cell,
    .comm-cell {
        font-size: 1rem;
        text-align: right;
    }

    .comm-cell {
        font-size: 1.1rem;
        color: #34d399;
    }

    /* Bouton supprimer */
    td:last-child {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        padding: 0;
    }

    td:last-child::before {
        display: none;
    }

    .btn-icon {
        padding: 0.5rem;
        font-size: 0.9rem;
        background: rgba(239, 68, 68, 0.1);
        border-radius: 8px;
    }

    /* Boutons d'action */
    .actions {
        gap: 0.6rem;
        margin-top: 0.5rem;
    }

    .btn-primary,
    .btn-secondary {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
        border-radius: 10px;
    }

    /* Blobs réduits pour perf */
    .blob-1 {
        width: 150px;
        height: 150px;
        filter: blur(60px);
    }

    .blob-2 {
        width: 120px;
        height: 120px;
        filter: blur(50px);
    }

    .blob-3 {
        display: none;
    }
}