/* ========================================
   assets/style.css - Thème Professionnel Corporate
   Design sobre et crédible pour clients B2B
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Palette professionnelle */
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --primary-light: #60A5FA;
    --secondary: #94A3B8;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    
    /* Gris élégants DARK */
    --gray-50: #1E293B;
    --gray-100: #334155;
    --gray-200: #475569;
    --gray-300: #64748B;
    --gray-400: #94A3B8;
    --gray-500: #CBD5E1;
    --gray-600: #E2E8F0;
    --gray-700: #F1F5F9;
    --gray-800: #F8FAFC;
    --gray-900: #FFFFFF;
    
    /* Fond et texte DARK */
    --bg-main: #0F172A;
    --bg-secondary: #1E293B;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    
    /* Ombres */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    /* Espacements */
    --sidebar-width: 280px;
    --header-height: 64px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ========================================
   SIDEBAR - Professionnelle et sobre
   ======================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-main);
    border-right: 1px solid var(--gray-200);
    padding: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Logo section */
.logo-section {
    padding: 24px 20px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--bg-main);
    text-align: center;
}

.logo-img {
    width: auto;
    max-width: 120px;
    height: auto;
    max-height: 60px;
    margin-bottom: 12px;
    display: block;
    object-fit: contain;
    margin-left: auto;
    margin-right: auto;
}

.app-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.app-title span {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 4px;
}

/* Navigation */
.main-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.main-nav ul {
    list-style: none;
}

/* Menu title */
.menu-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 16px 20px 8px;
}

/* Menu separator */
.menu-separator {
    height: 1px;
    background: var(--gray-200);
    margin: 12px 20px;
}

/* Links */
.sidebar a {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar a:hover {
    background: var(--gray-50);
    color: var(--text-primary);
    border-left-color: var(--primary);
}

.sidebar a.active {
    background: var(--gray-50);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.icon {
    margin-right: 12px;
    font-size: 18px;
    min-width: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Submenu */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--gray-50);
}

.submenu.active {
    max-height: 500px;
}

.submenu a {
    padding-left: 52px;
    font-size: 13px;
    border-left: none;
}

.submenu a:hover {
    background: var(--gray-100);
}

/* User section */
.user-sidebar {
    border-top: 1px solid var(--gray-200);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-top: auto;
    background: var(--bg-main);
}

.user-sidebar:hover {
    background: var(--gray-50);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    margin-right: 12px;
    flex-shrink: 0;
}

.user-info-sidebar strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.user-info-sidebar small {
    color: var(--success);
    font-size: 12px;
    font-weight: 500;
}

/* User popover */
.user-popover-sidebar {
    position: absolute;
    bottom: 70px;
    left: 20px;
    right: 20px;
    background: var(--bg-main);
    padding: 8px;
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-200);
    display: none;
    z-index: 100;
}

.user-popover-sidebar.active {
    display: block;
}

.user-popover-sidebar a {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: transparent;
    color: var(--text-primary);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: 0.2s;
    border-left: none;
}

.user-popover-sidebar a:hover {
    background: var(--gray-100);
    color: var(--danger);
}

/* Menu toggle (mobile) */
.menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    background: var(--primary);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    border: none;
}

.menu-toggle:hover {
    background: var(--primary-dark);
}

/* Main content */
main {
    margin-left: var(--sidebar-width);
    padding: 32px 40px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    max-width: 1600px;
}

/* ========================================
   COMPOSANTS GLOBAUX
   ======================================== */

/* Page header */
.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.page-header p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Card grid */
.card-grid {
    display: grid;
    gap: 24px;
    margin: 32px 0;
}

/* Card */
.card {
    background: var(--bg-main);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 12px;
}

.card-stat {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
    margin: 16px 0;
}

.card-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Form box */
.form-box {
    background: var(--bg-main);
    padding: 32px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    max-width: 600px;
    margin: 32px auto;
}

label {
    display: block;
    margin: 16px 0 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-main);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

/* Buttons */
button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
}

/* Bouton générer licence - espacé et centré */
form button[type="submit"] {
    /*margin-top: 32px !important;*/
    max-width: 400px !important;
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

button:hover,
.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

button:active,
.btn:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-group {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-group button,
.btn-group .btn {
    flex: 1;
}

/* Back button - Petit en bas à droite de la card */
.back-btn {
    display: inline-block;
    padding: 8px 16px;
    background: var(--gray-100);
    color: var(--text-primary);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.2s ease;
    position: absolute;
    bottom: 24px;
    right: 24px;
}

.back-btn:hover {
    background: var(--gray-200);
}

/* La form-box doit être relative */
.form-box {
    position: relative;
    padding-bottom: 60px; /* Espace pour le bouton en bas */
}

/* Clear float après le bouton retour */
.form-box {
    overflow: auto;
}

.form-box::after {
    content: "";
    display: table;
    clear: both;
}

/* Textarea */
textarea {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    background: var(--gray-50);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    margin: 16px 0;
    transition: all 0.2s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: var(--bg-main);
}

/* Table */
.table-container {
    background: var(--bg-main);
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    overflow: hidden;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: var(--gray-50);
    color: var(--text-primary);
    padding: 16px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--gray-200);
}

tbody td {
    padding: 16px 20px;
    color: var(--text-primary);
    font-size: 14px;
    vertical-align: middle;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--gray-50);
}

tbody td {
    padding: 16px 20px;
    color: var(--text-primary);
    font-size: 14px;
    vertical-align: middle;
    height: 70px; /* Hauteur fixe pour toutes les cellules */
}

/* Centrer les boutons dans les colonnes Licence et Package */
tbody td:nth-last-child(-n+2) {
    text-align: center;
}

tbody td form {
    height: 100%;
}

tbody td .btn-download {
    margin: 0;
    display: inline-flex;
}

/* Status badges */
.status {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-active {
    background: #D1FAE5;
    color: #065F46;
}

.status-expired {
    background: #FEE2E2;
    color: #991B1B;
}

/* Button in table */
.btn-download {
    padding: 8px 16px;
    background: var(--gray-100);
    color: var(--text-primary);
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-download:hover {
    background: var(--gray-200);
    border-color: var(--gray-400);
}

.btn-download.zip {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-download.zip:hover {
    background: var(--primary-dark);
}

/* Sort links */
.sort-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sort-link:hover {
    color: var(--primary);
}

.sort-link .arrow {
    font-size: 12px;
    opacity: 0.5;
}

/* Search bar */
.search-bar {
    max-width: 500px;
    margin: 0 auto 32px;
}

.search-bar form {
    position: relative;
    display: flex;
}

.search-bar input {
    flex: 1;
    padding: 12px 50px 12px 16px;
    background: var(--bg-main);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}

.search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-bar button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.search-bar button:hover {
    background: var(--primary-dark);
}

/* Messages */
.success {
    background: #D1FAE5;
    border: 1px solid #10B981;
    border-radius: 8px;
    padding: 16px 20px;
    color: #065F46;
    margin: 24px 0;
    font-weight: 500;
}

.error {
    background: #FEE2E2;
    border: 1px solid #EF4444;
    border-radius: 8px;
    padding: 16px 20px;
    color: #991B1B;
    margin: 24px 0;
    font-weight: 500;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-280px);
    }
    
    .sidebar.active {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }
    
    main {
        margin-left: 0;
        padding: 24px 20px;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .page-header h1 {
        font-size: 24px;
    }
    
    .card-stat {
        font-size: 36px;
    }
}

@media (max-width: 640px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .form-box {
        padding: 24px;
    }
}

