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

:root {
    --primary-color: #2563eb;
    --danger-color: #dc2626;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --gray-100: #f3f4f6;
    --gray-600: #6b7280;
    --gray-800: #1f2937;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
}

/* Mobile First */
.container {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.app-header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    gap: 1rem;
}

.app-header h1 {
    font-size: 1.25rem;
}

.user-info {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Cards */
.generator-card, .history-card, .admin-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

/* Formulaires */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
}

/* Boutons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-admin {
    background: #10b981;
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-small {
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
}

.btn:active {
    transform: scale(0.98);
}
a {
    text-decoration: none;
}

/* Grille d'étiquettes */
.labels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.label-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    background: white;
}

.barcode-container {
    margin-bottom: 0.5rem;
}

.label-code {
    font-family: monospace;
    font-size: 0.875rem;
    margin: 0.5rem 0;
    word-break: break-all;
}

/* Tableaux - Responsive */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.data-table th {
    background: var(--gray-100);
    font-weight: 600;
}

/* Login page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    margin: 0 auto;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.login-card h1 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-card h2 {
    font-size: 1.25rem;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--gray-600);
}

/* Alertes */
.alert {
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fee2e2;
    color: var(--danger-color);
    border: 1px solid #fecaca;
}

/* Notifications */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 1rem;
    border-radius: 8px;
    background: white;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.notification-success {
    background: var(--success-color);
    color: white;
}

.notification-error {
    background: var(--danger-color);
    color: white;
}

.search-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.search-group input {
    flex: 1;
    min-width: 200px;
}

.alert-warning {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    color: #92400e;
}

.alert-success {
    background: #d1fae5;
    border: 1px solid #10b981;
    color: #065f46;
}

.verification-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow);
}

/* Style du champ de recherche */
.barcode-input {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    letter-spacing: 2px;
}

.barcode-input::placeholder {
    font-family: Arial, sans-serif;
    letter-spacing: normal;
    color: #9ca3af;
}

.barcode-short {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.2em;
    background: #f0f9ff;
    padding: 2px 8px;
    border-radius: 4px;
    color: #0369a1;
}

.small-hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: 5px;
}

/* Onglets */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--gray-100);
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    color: var(--gray-600);
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: -2px;
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

.badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.label-info {
    font-size: 0.7rem;
    color: var(--gray-600);
    margin: 0.25rem 0;
}

.label-length {
    background: var(--gray-100);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
}

.search-input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    width: 200px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* Info box pour afficher le dernier code */
.info-box {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 12px;
    margin: 15px 0;
    font-size: 14px;
    color: #0369a1;
}

.info-box code {
    background: #e0f2fe;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    color: #0c4a6e;
}

.info-box strong {
    color: #0284c7;
}

/* Barre de progression */
.progress-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 400px;
    margin: 0 auto;
}

.progress-bar {
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    height: 20px;
}

.progress-fill {
    background: #3b82f6;
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    margin-top: 8px;
    font-size: 12px;
    text-align: center;
    color: #4b5563;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Styles pour les alertes avec boutons */
.alert {
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
}

.alert-header {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.alert-content {
    padding: 15px;
}

.alert-details {
    margin-bottom: 15px;
    line-height: 1.6;
}

.alert-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-top: 12px;
    margin-top: 5px;
}

.btn-print-verified, .btn-generate-this {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-print-verified {
    background: #2563eb;
    color: white;
}

.btn-print-verified:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.btn-generate-this {
    background: #10b981;
    color: white;
}

.btn-generate-this:hover {
    background: #059669;
    transform: translateY(-1px);
}

.barcode-highlight {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.1em;
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

.alert-warning .barcode-highlight {
    color: #92400e;
    background: #fffbeb;
}

.alert-success .barcode-highlight {
    color: #065f46;
    background: #d1fae5;
}

/* Animation pour les alertes */
.alert {
    animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Media Queries Desktop */
@media (min-width: 768px) {
    .container {
        padding: 2rem;
    }

    .app-header h1 {
        font-size: 1.5rem;
    }

    .labels-grid {
        gap: 1.5rem;
    }

    .stats-grid {
        gap: 1.5rem;
    }
}

@media print {
    .app-header,
    .generator-card,
    .history-card,
    .btn,
    .user-info {
        display: none;
    }

    .label-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
/* Notifications */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 1rem;
    border-radius: 8px;
    background: white;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    z-index: 1000;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 350px;
}

.notification-success {
    background: #10b981;
    color: white;
}

.notification-error {
    background: #ef4444;
    color: white;
}

.notification-warning {
    background: #f59e0b;
    color: white;
}

.notification-info {
    background: #3b82f6;
    color: white;
}

.notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    margin-left: auto;
    padding: 0 5px;
}

/* Input erreur */
.input-error {
    border-color: #ef4444 !important;
    background-color: #fee2e2 !important;
}

/* Bouton impression groupe */
#printBatchBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 999;
    display: none;
    animation: bounceIn 0.3s ease;
}

#printBatchBtn:hover {
    background: #2563eb;
    transform: scale(1.05);
}

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

/* Checkbox styling */
.select-label {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

#selectAll {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Animation chargement */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}