/* Reset et variables */
:root {
    --primary-color: #2980b9;
    --secondary-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #3498db;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --white: #ffffff;
    --gray: #95a5a6;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark-color);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: var(--white);
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
}

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

.header h1 {
    font-size: 24px;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    gap: 20px;
    list-style: none;
}

.nav-menu a {
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    transition: all 0.3s;
}

.nav-menu a:hover {
    background: var(--light-color);
    color: var(--primary-color);
}

/* Page d'accueil de connexion */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--light-color);
    font-size: 14px;
    color: var(--gray);
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--light-color);
    background: var(--light-color);
}

.card-header h3 {
    margin: 0;
    color: var(--dark-color);
}

.card-body {
    padding: 20px;
}

/* Statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 48px;
}

.stat-content h3 {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    color: var(--dark-color);
}

.stat-card.stat-success {
    border-left: 5px solid var(--secondary-color);
}

.stat-card.stat-info {
    border-left: 5px solid var(--info-color);
}

.stat-card.stat-warning {
    border-left: 5px solid var(--warning-color);
}

/* Formulaires */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--light-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: border-color 0.3s;
}

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

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--gray);
    font-size: 14px;
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

/* Boutons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

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

.btn-primary:hover {
    background: #2471a3;
    transform: translateY(-2px);
}

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

.btn-success:hover {
    background: #229954;
}

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

.btn-danger:hover {
    background: #c0392b;
}

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

.btn-secondary:hover {
    background: #7f8c8d;
}

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

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 18px;
}

/* Tableaux */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--light-color);
}

.table th {
    background: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-vendu {
    background: #d4edda;
    color: #155724;
}

.badge-non_vendu {
    background: #f8d7da;
    color: #721c24;
}

.badge-utilise {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-non_utilise {
    background: #fff3cd;
    color: #856404;
}

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

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

/* Alertes */
.alert {
    padding: 15px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 5px solid var(--secondary-color);
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 5px solid var(--danger-color);
}

/* Page header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.page-header h1 {
    margin: 0;
    color: var(--dark-color);
}

/* Page invité */
.guest-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

.guest-box {
    max-width: 600px;
    width: 100%;
}

.guest-header {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: var(--box-shadow);
}

.guest-header h1 {
    font-size: 36px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
    }
}

/* Code */
code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

/* Grille */
.row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.col-md-6 {
    flex: 1;
}

@media (max-width: 768px) {
    .row {
        flex-direction: column;
    }
}


/* Styles pour la page subscriptions */
.subscription-details {
    font-size: 14px;
    line-height: 1.6;
}

.subscription-details strong {
    display: inline-block;
    width: 120px;
    color: var(--dark-color);
}

.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    align-items: center;
}

.action-buttons .btn-sm {
    white-space: nowrap;
}

.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.quick-stat {
    background: var(--white);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
    transition: transform 0.3s;
}

.quick-stat:hover {
    transform: translateY(-3px);
}

.quick-stat h4 {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

.quick-stat p {
    font-size: 24px;
    font-weight: bold;
    color: var(--dark-color);
    margin: 0;
}

.payment-code {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--dark-color);
    border: 1px solid #dee2e6;
}

.badge-warning {
    background: var(--warning-color);
    color: var(--white);
}

/* Responsive pour les tableaux */
@media (max-width: 1200px) {
    .table {
        font-size: 14px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-buttons .btn-sm {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .quick-stats {
        grid-template-columns: 1fr;
    }
    
    /* Table responsive avec scroll horizontal */
    .card-body {
        overflow-x: auto;
    }
    
    .table {
        min-width: 1000px;
    }
}

/* Styles supplémentaires pour mobile - À ajouter dans download.php */


/* Optimisation pour petits écrans */
@media (max-width: 768px) {
    .download-page {
        padding: 0;
    }
    
    .download-container {
        border-radius: 0;
        min-height: 100vh;
    }
    
    .image-section {
        min-height: 50vh;
        max-height: 50vh;
    }
    
    .event-image {
        object-fit: cover;
        height: 100%;
    }
    
    .image-overlay {
        padding: 20px;
    }
    
    .image-overlay h2 {
        font-size: 24px;
    }
    
    .image-overlay p {
        font-size: 14px;
    }
    
    .form-section {
        padding: 30px 20px;
        min-height: 50vh;
    }
    
    .form-header h1 {
        font-size: 24px;
    }
    
    .form-header p {
        font-size: 14px;
    }
    
    .user-info {
        padding: 15px;
    }
    
    .form-group input {
        font-size: 16px; /* Évite le zoom automatique sur iOS */
    }
}

/* Très petits écrans */
@media (max-width: 375px) {
    .form-section {
        padding: 20px 15px;
    }
    
    .btn-submit,
    .btn-download {
        padding: 15px;
        font-size: 16px;
    }
    
    .success-icon {
        font-size: 60px;
    }
}

/* Orientation paysage sur mobile */
@media (max-width: 968px) and (orientation: landscape) {
    .download-container {
        grid-template-columns: 1fr 1fr;
        max-height: 100vh;
    }
    
    .image-section,
    .form-section {
        max-height: 100vh;
        overflow-y: auto;
    }
}

/* Mode sombre (si supporté) */
@media (prefers-color-scheme: dark) {
    .download-container {
        background: #1a1a1a;
    }
    
    .form-section {
        background: #1a1a1a;
    }
    
    .form-header h1,
    .user-info h3 {
        color: #ffffff;
    }
    
    .form-header p,
    .user-info p {
        color: #b0b0b0;
    }
    
    .user-info {
        background: #2a2a2a;
    }
    
    .form-group input {
        background: #2a2a2a;
        border-color: #404040;
        color: #ffffff;
    }
    
    .info-note {
        background: #2a3a4a;
        color: #b0b0b0;
    }
}

/* Accessibilité - Mode contraste élevé */
@media (prefers-contrast: high) {
    .btn-submit,
    .btn-download {
        border: 2px solid #000;
    }
    
    .form-group input:focus {
        border-width: 3px;
    }
}

/* Animation réduite pour ceux qui préfèrent */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Support des écrans tactiles */
@media (hover: none) and (pointer: coarse) {
    .btn-submit:active,
    .btn-download:active {
        transform: scale(0.98);
    }
    
    .form-group input {
        font-size: 16px; /* Évite le zoom sur iOS */
    }
}

/* iPad et tablettes */
@media (min-width: 768px) and (max-width: 1024px) {
    .download-container {
        max-width: 900px;
    }
    
    .image-section {
        min-height: 500px;
    }
}

/* Grands écrans */
@media (min-width: 1400px) {
    .download-container {
        max-width: 1400px;
    }
    
    .form-section {
        padding: 80px 70px;
    }
    
    .form-header h1 {
        font-size: 38px;
    }
}
