/* =======================
   Base & Reset
======================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

/* =======================
   Header
======================= */
header {
    background: linear-gradient(90deg, #121212, #1f1f1f);
    color: #f5f5f5;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7);
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Header icon animation */
header h1 span {
    display: inline-block;
    transition: transform 0.4s ease;
}

header h1:hover span {
    transform: rotate(20deg) scale(1.3);
}

/* =======================
   Container
======================= */
.container {
    max-width: 900px;
    margin: auto;
    padding: 1rem;
}

/* =======================
   User menu
======================= */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-menu {
    position: relative;
}

.user-button {
    background: transparent;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: #e0e0e0;
}

.user-dropdown {
    position: absolute;
    right: 0;
    top: 2.8rem;
    min-width: 140px;
    background: rgba(30, 30, 30, 0.95);
    border-radius: 10px;
    padding: 0.5rem;
    display: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

.user-menu:hover .user-dropdown {
    display: block;
}

/* Logout button look */
.logout-btn {
    display: block;
    padding: 0.6rem 1rem;
    color: #f87171;
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    text-align: center;
}

.logout-btn:hover {
    background: rgba(248, 113, 113, 0.15);
}

/* =======================
   Glass Cards
======================= */
.card {
    background: rgba(30, 30, 30, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 40px rgba(37, 99, 235, 0.4);
    background: rgba(40, 40, 40, 0.7);
}

/* =======================
   Titles
======================= */
h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #f0f0f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s ease;
}

/* =======================
   Labels & Inputs
======================= */
label {
    font-weight: 600;
    display: block;
    margin-top: 1rem;
    color: #ccc;
}

input[type="text"],
input[type="date"],
input[type="password"],
button {
    width: 100%;
    padding: 0.8rem;
    margin-top: 0.4rem;
    font-size: 1rem;
    border-radius: 12px;
    border: none;
    outline: none;
    transition: all 0.3s ease;
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
}

/* Input glow */
input[type="text"],
input[type="date"] {
    background: rgba(25, 25, 25, 0.6);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
}

input[type="text"]:focus,
input[type="date"]:focus {
    border: 1px solid #2563eb;
    box-shadow: 0 0 12px #2563eb66;
    background: rgba(30, 30, 30, 0.8);
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
}

input[type="password"] {
    background: rgba(25, 25, 25, 0.6);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
}

input[type="password"]:focus {
    border: 1px solid #2563eb;
    box-shadow: 0 0 12px #2563eb66;
    background: rgba(30, 30, 30, 0.8);
}

/* =======================
   Buttons pro style
======================= */
button {
    position: relative;
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: white;
    cursor: pointer;
    border-radius: 12px;
    font-weight: 600;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.5);
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(37, 99, 235, 0.6);
}

/* Button shine effect */
button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.25) 0%, transparent 60%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    border-radius: 50%;
}

button:hover::before {
    opacity: 1;
    transform: translate(20%, 20%) scale(1.2);
}

/* =======================
   Grid layout
======================= */
.grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 700px) {
    .grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* =======================
   Tables modernes
======================= */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: rgba(25, 25, 25, 0.6);
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

th,
td {
    padding: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
    color: #e0e0e0;
}

th {
    background: rgba(40, 40, 40, 0.7);
}

tr:hover {
    background: rgba(60, 60, 60, 0.5);
    transform: scale(1.01);
    transition: transform 0.2s ease, background 0.2s ease;
}

/* =======================
   Delete link
======================= */
a.delete {
    color: #f87171;
    text-decoration: none;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

a.delete:hover {
    color: #fca5a5;
    transform: scale(1.2) rotate(-10deg);
}

/* =======================
   Responsive tweaks
======================= */
@media (max-width: 700px) {
    body {
        font-size: 0.95rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    button,
    input {
        font-size: 0.95rem;
    }
}

/* =======================
   Icon buttons
======================= */
.actions {
    display: flex;
    gap: 0.4rem;
}

.icon-btn {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 6px;
    color: #e0e0e0;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.icon-btn.delete {
    color: #f87171;
}

.icon-btn.delete:hover {
    background: rgba(248, 113, 113, 0.15);
}

form.inline {
    display: inline;
}

/* =======================
   Reorder table
======================= */
.sort-link {
    color: #e0e0e0;
    text-decoration: none;
    font-weight: 600;
}

.sort-link:hover {
    text-decoration: underline;
}

/* =======================
   Edition animation
======================= */
tr.editing {
    background: rgba(37, 99, 235, 0.15) !important;
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.4);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

tr.editing input {
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

.actions button {
    min-width: 60px;
}

/* =======================
   Modal
======================= */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: rgba(30, 30, 30, 0.95);
    padding: 1.5rem;
    border-radius: 16px;
    max-width: 350px;
    width: 100%;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-actions button {
    flex: 1;
}

button.danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* =======================
   Table & actions responsive
======================= */
@media (max-width: 700px) {

    /* Actions sous chaque ligne, en colonne */
    .actions {
        display: flex;
        flex-direction: column;
        margin-top: 0.5rem;
        gap: 0.3rem;
    }

    .actions button {
        width: 100%;
    }

    /* Ligne en mode édition plus lisible */
    tr.editing {
        display: block;
        margin-bottom: 1rem;
        box-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
        border-radius: 12px;
        padding: 0.5rem;
    }

    tr.editing td {
        display: block;
        width: 100%;
        margin-bottom: 0.4rem;
    }

    tr.editing td input {
        width: 100%;
    }

    /* Cacher les th pour plus de place */
    table th {
        display: none;
    }

    table,
    tbody,
    tr,
    td {
        display: block;
        width: 100%;
    }

    table {
        border-radius: 12px;
        overflow: hidden;
    }
}

/* =======================
   Modal responsive mobile
======================= */
@media (max-width: 700px) {
    .modal-content {
        max-width: 90%;
        padding: 1rem;
    }

    /* Les boutons superposés avec un petit gap */
    .modal-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-actions button {
        width: 100%;
        font-size: 0.95rem;
        padding: 0.7rem;
    }
}

/* =======================
   Reason field
======================= */
.grid-full {
    grid-column: 1 / -1;
}