/* =====================================================
   DENTELLE STUDIO — STYLE PRINCIPAL
   Direction artistique : féminine, élégante, dentelle
   ===================================================== */

:root {
    /* Couleurs */
    --ivoire: #FAF6F2;
    --ivoire-fonce: #F2EBE3;
    --rose-poudre: #C9A0A8;
    --rose-clair: #E8C4C4;
    --rose-tres-clair: #F7E8E8;
    --noir-profond: #1A1A1A;
    --noir-doux: #3A3133;
    --gris-doux: #8A7F82;
    --dore: #C9A961;
    --dore-clair: #E5C988;
    --vert-success: #6B8E5A;
    --rouge-error: #B85450;

    /* Typo */
    --font-serif: 'Cormorant Garamond', 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-script: 'Pinyon Script', cursive;

    /* Tailles */
    --max-width: 1280px;
    --radius: 8px;
    --radius-lg: 16px;
    --shadow-soft: 0 8px 32px rgba(58, 49, 51, 0.08);
    --shadow-strong: 0 12px 40px rgba(58, 49, 51, 0.15);
}

/* =================== RESET =================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-sans);
    color: var(--noir-doux);
    background: var(--ivoire);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Texture de dentelle subtile en arriere plan */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(201, 160, 168, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(201, 169, 97, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

a { color: var(--noir-doux); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--rose-poudre); }

img { max-width: 100%; height: auto; }

/* =================== TYPO =================== */
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 500; line-height: 1.2; color: var(--noir-profond); letter-spacing: -0.01em; }
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.2rem; }

.page-title {
    font-size: 2.75rem;
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}
.page-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 60px;
    height: 1px;
    background: var(--dore);
}

/* =================== NAV =================== */
.topnav {
    background: var(--ivoire);
    border-bottom: 1px solid rgba(201, 160, 168, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: rgba(250, 246, 242, 0.92);
}
.topnav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}
.brand {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    line-height: 1;
}
.brand-script {
    font-family: var(--font-script);
    font-size: 2rem;
    color: var(--rose-poudre);
}
.brand-thin {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-style: italic;
    color: var(--noir-doux);
    letter-spacing: 0.15em;
    text-transform: lowercase;
}
.mainmenu {
    display: flex;
    gap: 1.8rem;
    flex: 1;
    margin-left: 2rem;
}
.mainmenu a {
    font-size: 0.92rem;
    color: var(--noir-doux);
    padding: 0.4rem 0;
    border-bottom: 1px solid transparent;
    transition: all .2s ease;
}
.mainmenu a:hover { border-bottom-color: var(--rose-poudre); color: var(--noir-profond); }
.mainmenu a.cta {
    background: var(--noir-profond);
    color: var(--ivoire);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    border: none;
}
.mainmenu a.cta:hover { background: var(--rose-poudre); color: var(--ivoire); }
.user-zone { display: flex; align-items: center; gap: 1rem; }
.user-pseudo {
    font-size: 0.85rem;
    color: var(--gris-doux);
    font-style: italic;
}
.logout {
    font-size: 0.85rem;
    color: var(--rose-poudre);
    padding: 0.3rem 0.8rem;
    border: 1px solid rgba(201, 160, 168, 0.3);
    border-radius: var(--radius);
}
.logout:hover { background: var(--rose-poudre); color: var(--ivoire); }
.burger { display: none; background: transparent; border: 0; cursor: pointer; flex-direction: column; gap: 5px; padding: 8px; }
.burger span { width: 26px; height: 1.5px; background: var(--noir-profond); display: block; }

/* =================== MAIN =================== */
.page-main {
    flex: 1;
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 3rem 2rem;
}
body.no-nav .page-main { padding: 0; max-width: 100%; }

/* =================== FOOTER =================== */
.page-footer {
    text-align: center;
    padding: 2rem;
    font-size: 0.85rem;
    color: var(--gris-doux);
    font-style: italic;
}
.lace-divider {
    width: 200px;
    height: 1px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(90deg, transparent, var(--rose-poudre), transparent);
    position: relative;
}
.lace-divider::before, .lace-divider::after {
    content: '✦';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: var(--dore);
}
.lace-divider::before { left: 0; }
.lace-divider::after { right: 0; }

/* =================== CARDS =================== */
.card {
    background: var(--ivoire);
    border: 1px solid rgba(201, 160, 168, 0.15);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-soft);
    transition: box-shadow .3s ease;
}
.card:hover { box-shadow: var(--shadow-strong); }
.card-title {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: var(--noir-profond);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: linear-gradient(135deg, var(--ivoire) 0%, var(--ivoire-fonce) 100%);
    border: 1px solid rgba(201, 169, 97, 0.15);
    border-radius: var(--radius-lg);
    padding: 1.8rem;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    background: radial-gradient(circle, var(--rose-tres-clair) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}
.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gris-doux);
    margin-bottom: 0.5rem;
}
.stat-value {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    font-weight: 500;
    color: var(--noir-profond);
    line-height: 1;
}
.stat-sub {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--gris-doux);
    font-style: italic;
}

/* =================== FORMS =================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.field.full { grid-column: 1 / -1; }
.field label {
    font-size: 0.85rem;
    color: var(--noir-doux);
    font-weight: 500;
    letter-spacing: 0.02em;
}
.field label .req { color: var(--rose-poudre); }
.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"],
.field select,
.field textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(58, 49, 51, 0.15);
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    background: var(--ivoire);
    color: var(--noir-profond);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--rose-poudre);
    box-shadow: 0 0 0 3px rgba(201, 160, 168, 0.15);
}
.field .hint {
    font-size: 0.78rem;
    color: var(--gris-doux);
    font-style: italic;
}

/* =================== BUTTONS =================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.8rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .25s ease;
    text-decoration: none;
    letter-spacing: 0.02em;
}
.btn-primary {
    background: var(--noir-profond);
    color: var(--ivoire);
}
.btn-primary:hover {
    background: var(--rose-poudre);
    color: var(--ivoire);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(201, 160, 168, 0.3);
}
.btn-gold {
    background: var(--dore);
    color: var(--ivoire);
}
.btn-gold:hover { background: var(--dore-clair); }
.btn-outline {
    background: transparent;
    color: var(--noir-doux);
    border-color: rgba(58, 49, 51, 0.2);
}
.btn-outline:hover { background: var(--noir-profond); color: var(--ivoire); border-color: var(--noir-profond); }
.btn-success { background: var(--vert-success); color: var(--ivoire); }
.btn-danger { background: var(--rouge-error); color: var(--ivoire); }
.btn-small { padding: 0.5rem 1rem; font-size: 0.82rem; }

.actions-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }

/* =================== LOGIN PAGE =================== */
.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    background:
        radial-gradient(circle at 20% 30%, rgba(201, 160, 168, 0.18) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(201, 169, 97, 0.12) 0%, transparent 50%),
        var(--ivoire);
    position: relative;
}
.login-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpath d='M40 8 Q44 24 60 24 Q44 28 40 44 Q36 28 20 24 Q36 24 40 8 Z' fill='%23C9A0A8' fill-opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
}
.login-card {
    background: rgba(250, 246, 242, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(201, 160, 168, 0.2);
    border-radius: var(--radius-lg);
    padding: 3.5rem 3rem;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(58, 49, 51, 0.1);
    position: relative;
    z-index: 1;
}
.login-card .brand {
    justify-content: center;
    margin-bottom: 2rem;
}
.login-card .brand-script { font-size: 3rem; }
.login-card .brand-thin { font-size: 1.3rem; }
.login-card h1 {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 400;
    font-style: italic;
    margin-bottom: 2rem;
    color: var(--gris-doux);
}
.login-card .field { margin-bottom: 1.2rem; }
.login-card .btn { width: 100%; }

/* =================== ALERTS =================== */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    border: 1px solid;
}
.alert-success { background: rgba(107, 142, 90, 0.08); border-color: rgba(107, 142, 90, 0.3); color: var(--vert-success); }
.alert-error { background: rgba(184, 84, 80, 0.08); border-color: rgba(184, 84, 80, 0.3); color: var(--rouge-error); }
.alert-warning { background: rgba(201, 169, 97, 0.1); border-color: rgba(201, 169, 97, 0.3); color: #8B7333; }
.alert-info { background: rgba(201, 160, 168, 0.1); border-color: rgba(201, 160, 168, 0.3); color: var(--rose-poudre); }

/* =================== TABLES =================== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(201, 160, 168, 0.15);
    background: var(--ivoire);
}
table.data {
    width: 100%;
    border-collapse: collapse;
}
table.data th {
    background: var(--ivoire-fonce);
    text-align: left;
    padding: 1rem;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--noir-profond);
    letter-spacing: 0.03em;
    border-bottom: 1px solid rgba(201, 160, 168, 0.2);
    white-space: nowrap;
}
table.data td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(201, 160, 168, 0.1);
    font-size: 0.9rem;
}
table.data tr:hover td { background: rgba(250, 246, 242, 0.6); }
table.data tr:last-child td { border-bottom: 0; }

/* Statut badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.badge-declare { background: rgba(201, 160, 168, 0.15); color: var(--rose-poudre); }
.badge-depose { background: rgba(201, 169, 97, 0.15); color: #8B7333; }
.badge-verifie { background: rgba(107, 142, 90, 0.15); color: var(--vert-success); }
.badge-cash { background: rgba(58, 49, 51, 0.08); color: var(--noir-doux); }
.badge-virement { background: rgba(201, 160, 168, 0.1); color: var(--rose-poudre); }
.badge-cb { background: rgba(201, 169, 97, 0.1); color: #8B7333; }

/* =================== CODE DISPLAY =================== */
.code-display {
    background: linear-gradient(135deg, var(--noir-profond) 0%, var(--noir-doux) 100%);
    color: var(--dore-clair);
    padding: 3rem 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    margin: 2rem 0;
    box-shadow: var(--shadow-strong);
    position: relative;
    overflow: hidden;
}
.code-display::before, .code-display::after {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(201, 169, 97, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}
.code-display::before { top: -40px; left: -40px; }
.code-display::after { bottom: -40px; right: -40px; }
.code-label {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 0.95rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--dore-clair);
    opacity: 0.8;
    margin-bottom: 1rem;
}
.code-value {
    font-family: var(--font-serif);
    font-size: 5rem;
    font-weight: 600;
    letter-spacing: 0.5rem;
    color: var(--ivoire);
    line-height: 1;
}
.code-instructions {
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: rgba(250, 246, 242, 0.85);
    font-style: italic;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* =================== INVOICE NOTICE =================== */
.invoice-reminder {
    background: linear-gradient(135deg, var(--rose-tres-clair) 0%, rgba(232, 196, 196, 0.5) 100%);
    border-left: 3px solid var(--rose-poudre);
    padding: 1.5rem;
    border-radius: var(--radius);
    margin: 2rem 0;
}
.invoice-reminder h3 {
    color: var(--noir-profond);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.invoice-reminder p { font-size: 0.92rem; }

/* =================== UTILS =================== */
.row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.text-muted { color: var(--gris-doux); }
.text-center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }
.mb-1 { margin-bottom: 1rem; }

.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: end;
}
.filter-bar .field { flex: 1; min-width: 160px; margin-bottom: 0; }

/* =================== RESPONSIVE =================== */
@media (max-width: 900px) {
    .burger { display: flex; margin-left: auto; }
    .mainmenu, .user-zone { display: none; }
    body.menu-open .mainmenu,
    body.menu-open .user-zone {
        display: flex;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--ivoire);
        flex-direction: column;
        padding: 1.5rem 2rem;
        border-bottom: 1px solid rgba(201, 160, 168, 0.2);
        gap: 1rem;
    }
    body.menu-open .user-zone { top: calc(100% + 200px); }
    .page-main { padding: 2rem 1rem; }
    .page-title { font-size: 2rem; }
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    .login-card { padding: 2.5rem 1.5rem; }
    .login-card .brand-script { font-size: 2.5rem; }
    .code-value { font-size: 3.5rem; letter-spacing: 0.3rem; }
    .stat-value { font-size: 1.8rem; }
    .actions-row .btn { flex: 1; }
}
