@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Playfair+Display:ital,wght@0,600;0,700;1,600&display=swap');

:root {
    /* Couleurs principales */
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #14b8a6;
    --secondary: #6366f1;
    --secondary-dark: #4f46e5;
    --accent: #f59e0b;
    
    /* Couleurs de fond */
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: rgba(255,255,255,0.85);
    
    /* Couleurs de texte */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    /* Couleurs de statut */
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Ombres */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px rgba(0,0,0,0.12);
    
    /* Autres */
    --ink: #0f172a;
    --muted: #94a3b8;
    --cream: #f8fafc;
    --card: #ffffff;
    --green: #0d9488;
    --lime: #a3e635;
    --line: #e2e8f0;
    --red: #ef4444;
}

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

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

button, input, select {
    font: inherit;
}

button {
    cursor: pointer;
    border: 0;
    transition: all 0.2s ease;
}

.hidden {
    display: none !important;
}

/* ===== PAGE DE CONNEXION ===== */
.login {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #0f172a;
    color: white;
}

.login section {
    background: #ffffff;
    color: var(--text-primary);
    padding: 11vh 12%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(145deg, #0d9488, #0f766e);
    color: #a3e635;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 20px;
    margin-bottom: 30px;
    box-shadow: 0 12px 30px rgba(13, 148, 136, 0.3);
}

.login h1 {
    font-size: 40px;
    margin: 0;
    font-family: 'Playfair Display', serif;
    letter-spacing: -1px;
}

.login h1 span {
    color: var(--primary);
}

.login section > p {
    color: var(--text-muted);
    margin: 8px 0 34px;
    font-size: 16px;
}

.login form {
    max-width: 380px;
}

.login label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin: 16px 0 7px;
    color: var(--text-secondary);
}

.login input {
    width: 100%;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    background: #f8fafc;
    outline-color: var(--primary);
    font-size: 15px;
    transition: all 0.2s ease;
}

.login input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.1);
}

.login form button:first-of-type {
    background: linear-gradient(135deg, #0d9488, #0f766e);
    color: white;
    width: 100%;
    margin-top: 25px;
    padding: 16px;
    border-radius: 12px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    box-shadow: 0 8px 24px rgba(13, 148, 136, 0.25);
    transition: all 0.2s ease;
}

.login form button:first-of-type:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(13, 148, 136, 0.35);
}

.login small {
    display: block;
    color: var(--text-muted);
    margin-top: 17px;
    font-size: 12px;
}

.login aside {
    padding: 13vh 14%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #0f172a, #1e293b);
}

.glow {
    position: absolute;
    width: 500px;
    height: 500px;
    border: 1px solid rgba(163, 230, 53, 0.2);
    border-radius: 50%;
    right: -190px;
    bottom: -220px;
    box-shadow: 0 0 0 60px rgba(163, 230, 53, 0.03), 0 0 0 120px rgba(163, 230, 53, 0.02);
}

.eyebrow {
    letter-spacing: 2px;
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 9px;
    text-transform: uppercase;
}

.login .eyebrow {
    color: #a3e635;
}

.login h2 {
    font-family: 'Playfair Display', serif;
    font-size: 48px;
    line-height: 1.13;
    margin: 0;
    letter-spacing: -1px;
}

.login h2 em {
    color: #a3e635;
}

.facts {
    margin-top: 70px;
    display: grid;
    gap: 15px;
    color: #cbd5e1;
    font-size: 15px;
}

.facts span::first-letter {
    color: #a3e635;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 250px;
    background: linear-gradient(175deg, #0f172a, #1e293b);
    position: fixed;
    inset: 0 auto 0 0;
    padding: 28px 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 30px rgba(0,0,0,0.1);
    z-index: 100;
}

.logo {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 22px;
    padding: 0 12px;
    color: white;
    letter-spacing: -0.5px;
}

.logo i {
    font-family: 'Inter', sans-serif;
    font-style: normal;
    font-size: 12px;
    background: #0d9488;
    color: #a3e635;
    padding: 6px 10px;
    border-radius: 8px;
    margin-right: 8px;
    font-weight: 800;
}

.logo span {
    color: #a3e635;
}

.role {
    color: #94a3b8;
    font-size: 10px;
    letter-spacing: 1.5px;
    padding: 25px 12px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 16px;
    text-transform: uppercase;
}

nav {
    display: grid;
    gap: 4px;
    flex: 1;
}

nav button {
    background: transparent;
    text-align: left;
    padding: 12px 14px;
    border-radius: 10px;
    color: #94a3b8;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

nav button:hover {
    background: rgba(255,255,255,0.05);
    color: white;
    transform: translateX(3px);
}

nav button.active {
    background: rgba(13, 148, 136, 0.15);
    color: #a3e635;
    border-color: rgba(163, 230, 53, 0.1);
}

nav b {
    font-size: 18px;
    width: 30px;
    display: inline-block;
    font-weight: 400;
}

.profile {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 16px 7px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    background: linear-gradient(145deg, #a3e635, #0d9488);
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 16px;
}

.profile strong {
    display: block;
    font-size: 13px;
    color: white;
}

.profile small {
    display: block;
    font-size: 10px;
    color: #94a3b8;
}

.icon-btn {
    margin-left: auto;
    background: none;
    color: #94a3b8;
    font-size: 20px;
    transition: color 0.2s ease;
}

.icon-btn:hover {
    color: white;
}

/* ===== MAIN CONTENT ===== */
main {
    margin-left: 250px;
    min-height: 100vh;
    padding: 32px 45px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 27px;
}

header h1 {
    font: 700 32px 'Playfair Display', serif;
    margin: 0;
    letter-spacing: -0.5px;
}

.head-right {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 13px;
    background: rgba(255,255,255,0.8);
    padding: 6px 6px 6px 16px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
}

.notify {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 10px;
    color: var(--text-secondary);
    font-size: 16px;
    transition: all 0.2s ease;
}

.notify:hover {
    background: #f1f5f9;
    transform: scale(1.05);
}

/* ===== GRID ===== */
.grid {
    display: grid;
    gap: 20px;
}

.sale-grid {
    grid-template-columns: 1.3fr 0.7fr;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 18px;
    padding: 22px 24px;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.5s ease-out forwards;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.card h3 {
    font-size: 16px;
    margin: 0 0 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== TOOLS ===== */
.tools {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.search {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 11px;
    padding: 11px 16px;
    background: #f8fafc;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 150px;
}

.search:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.1);
}

/* ===== BUTTONS ===== */
.primary {
    background: linear-gradient(135deg, #0d9488, #0f766e);
    color: white;
    padding: 11px 18px;
    border-radius: 11px;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.2);
    transition: all 0.2s ease;
}

.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(13, 148, 136, 0.3);
}

.secondary {
    background: #f1f5f9;
    color: var(--text-secondary);
    padding: 11px 18px;
    border-radius: 11px;
    font-weight: 700;
    font-size: 13px;
    border: 1px solid #e2e8f0;
}

.secondary:hover {
    background: #e2e8f0;
}

.danger {
    background: #fef2f2;
    color: #ef4444;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 12px;
    border: 1px solid #fecaca;
}

.danger:hover {
    background: #fee2e2;
}

/* ===== TABLE ===== */
table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
}

th {
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-align: left;
    padding: 12px 10px;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 700;
}

td {
    padding: 14px 10px;
    border-bottom: 1px solid #f1f5f9;
}

td strong {
    font-size: 14px;
}

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: rgba(13, 148, 136, 0.04);
}

/* ===== QTY ===== */
.qty {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty button {
    background: #f1f5f9;
    color: var(--text-secondary);
    border-radius: 7px;
    width: 26px;
    height: 26px;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.15s ease;
}

.qty button:hover {
    background: #e2e8f0;
}

/* ===== STOCK ===== */
.stock {
    font-size: 11px;
    color: var(--text-muted);
}

/* ===== SUMMARY ===== */
.summary {
    background: linear-gradient(155deg, #0f172a, #1e293b);
    border: 0;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    color: white;
}

.summary h3 {
    color: #94a3b8;
}

.summary .line {
    display: flex;
    justify-content: space-between;
    margin: 13px 0;
    color: #cbd5e1;
    font-size: 14px;
}

.summary .total {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 22px;
    padding-top: 16px;
    font-weight: 700;
    font-size: 20px;
    color: #a3e635;
}

.payment {
    margin-top: 20px;
}

.payment label {
    font-size: 12px;
    color: #94a3b8;
    display: block;
    margin-bottom: 7px;
}

.payment input {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    color: white;
    margin-bottom: 12px;
    font-size: 15px;
}

.payment input:focus {
    outline: 2px solid var(--primary);
}

.change {
    display: flex;
    justify-content: space-between;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 13px;
    margin: 5px 0 18px;
    color: #94a3b8;
}

.change b {
    color: #a3e635;
}

.summary .primary {
    width: 100%;
    background: linear-gradient(135deg, #a3e635, #0d9488);
    color: #0f172a;
}

/* ===== STATS ===== */
.stats {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 20px;
}

.stat {
    padding: 20px 22px;
    border-radius: 16px;
    min-height: 120px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.stat p {
    margin: 0;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.stat h2 {
    font-size: 26px;
    margin: 10px 0 0;
    font-weight: 800;
}

.stat .trend {
    color: var(--primary);
    font-size: 12px;
}

/* ===== PILLS ===== */
.pill {
    padding: 5px 12px;
    border-radius: 20px;
    background: #f1f5f9;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    display: inline-block;
}

.pill.red {
    background: #fef2f2;
    color: #ef4444;
}

.pill.green {
    background: #ecfdf5;
    color: #0d9488;
}

/* ===== FORM GRID ===== */
.form-grid {
    grid-template-columns: 1fr 1fr;
}

.form-grid label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}

.form-grid input,
.form-grid select {
    display: block;
    width: 100%;
    margin: 7px 0 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 11px 14px;
    font-size: 14px;
    background: #f8fafc;
}

.form-grid input:focus,
.form-grid select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ===== EMPTY ===== */
.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 14px;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    right: 28px;
    bottom: 25px;
    background: var(--text-primary);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-xl);
    z-index: 9999;
    border-left: 4px solid var(--primary);
    animation: slideUp 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

/* ===== MODAL ===== */
#modal {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
}

#modal.show {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    pointer-events: auto;
    display: grid;
    place-items: center;
}

.modal-box {
    background: white;
    border-radius: 20px;
    padding: 28px 32px;
    width: 420px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 40px 80px rgba(0,0,0,0.2);
    animation: modalIn 0.3s ease-out forwards;
}

.modal-box h2 {
    font: 700 24px 'Playfair Display', serif;
    margin-top: 0;
    color: var(--text-primary);
}

.modal-box textarea,
.modal-box input,
.modal-box select {
    width: 100%;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 11px 14px;
    margin: 8px 0 14px;
    font-size: 14px;
    background: #f8fafc;
}

.modal-box textarea {
    height: 80px;
    resize: vertical;
}

.modal-box textarea:focus,
.modal-box input:focus,
.modal-box select:focus {
    outline: none;
    border-color: var(--primary);
}

.actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes modalIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .login {
        grid-template-columns: 1fr;
    }
    
    .login aside {
        display: none;
    }
    
    .sale-grid {
        grid-template-columns: 1fr;
    }
    
    .sale-grid .summary {
        grid-column: auto;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        width: 68px;
        padding: 16px 8px;
    }
    
    .sidebar .logo {
        font-size: 0;
        padding: 0;
        text-align: center;
    }
    
    .sidebar .logo i {
        font-size: 20px;
        margin: 0;
    }
    
    .sidebar .role,
    .sidebar nav span,
    .profile div:not(.avatar) {
        display: none;
    }
    
    .sidebar nav button {
        font-size: 0;
        text-align: center;
        padding: 10px;
    }
    
    .sidebar nav b {
        font-size: 20px;
        width: auto;
        margin: 0;
    }
    
    main {
        margin-left: 68px;
        padding: 20px 16px;
    }
    
    .stats {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    header h1 {
        font-size: 24px;
    }
    
    .head-right {
        font-size: 11px;
        padding: 4px 4px 4px 12px;
    }
    
    .modal-box {
        width: 95vw;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .stats {
        grid-template-columns: 1fr;
    }
    
    header {
        flex-direction: column;
        gap: 12px;
    }
    
    .head-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .manager-hero {
        padding: 16px;
        flex-direction: column;
        text-align: center;
    }
    
    .manager-hero .hero-orb {
        display: none;
    }
    
    table {
        font-size: 11px;
        min-width: 450px;
    }
    
    .tools {
        flex-direction: column;
    }
    
    .tools .search {
        min-width: 100%;
    }
}