/* Reset et styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f5f7fb;
    font-size: 16px;
    line-height: 1.5;
}

/* Conteneurs responsives */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

/* Cards responsives */
.card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Grilles responsives */
.grid-2, .grid-3, .grid-4 {
    display: grid;
    gap: 15px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Boutons responsives */
.btn, button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    max-width: 100%;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

/* Formulaires responsives */
input, select, textarea {
    width: 100%;
    padding: 14px 15px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 12px;
    margin: 8px 0;
    -webkit-appearance: none;
    appearance: none;
}

input:focus, select:focus {
    outline: none;
    border-color: #667eea;
}

/* Tables responsives */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    min-width: 500px;
    border-collapse: collapse;
    background: white;
    border-radius: 15px;
    overflow: hidden;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #667eea;
    color: white;
}

/* Navigation responsive */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.navbar-brand {
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-menu {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.navbar-menu a {
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 10px;
    transition: background 0.3s;
}

.navbar-menu a:hover, .navbar-menu a.active {
    background: rgba(255,255,255,0.2);
}

/* Menu hamburger pour mobile */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    width: auto;
    padding: 5px 10px;
}

/* QR Code responsive */
.qr-container {
    text-align: center;
    padding: 20px;
}

.qr-container canvas, .qr-container img {
    max-width: 100%;
    height: auto;
}

/* Progress bar responsive */
.progress-bar {
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    height: 20px;
    margin: 15px 0;
}

.progress-fill {
    background: linear-gradient(90deg, #667eea, #764ba2);
    height: 100%;
    transition: width 0.5s;
}

/* Points display responsive */
.points {
    font-size: clamp(32px, 8vw, 48px);
    font-weight: bold;
    color: #667eea;
    text-align: center;
}

/* Stats cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.stat-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 15px;
    text-align: center;
}

.stat-number {
    font-size: clamp(20px, 6vw, 28px);
    font-weight: bold;
    color: #667eea;
}

/* Coupon cards responsive */
.cupon-card {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border: 2px dashed #28a745;
    border-radius: 15px;
    padding: 15px;
    margin: 10px 0;
}

.cupon-code {
    font-family: monospace;
    font-size: 16px;
    font-weight: bold;
    color: #28a745;
    word-break: break-all;
}

/* Visit history items */
.visita-item {
    background: #f8f9fa;
    padding: 15px;
    margin: 10px 0;
    border-left: 4px solid #667eea;
    border-radius: 8px;
}

/* Scan video responsive */
.scanner-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.scanner-video {
    width: 100%;
    height: auto;
    border-radius: 15px;
    border: 3px solid #667eea;
}

/* Media Queries */
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .navbar-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        text-align: center;
    }
    
    .navbar-menu.active {
        display: flex;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .navbar {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    th, td {
        padding: 8px;
        font-size: 14px;
    }
    
    .btn, button {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 15px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    h2 {
        font-size: 20px;
    }
    
    h3 {
        font-size: 18px;
    }
    
    .cupon-code {
        font-size: 12px;
    }
}

/* Touch-friendly */
button, .btn, a {
    min-height: 44px;
    touch-action: manipulation;
}

input, select, textarea {
    font-size: 16px; /* Prevent zoom on iOS */
}

/* iOS specific */
@supports (-webkit-touch-callout: none) {
    input, select, textarea, button {
        border-radius: 12px;
    }
}
