/**
 * app.css — Styles custom PWA Scan Badges LUDOVIA#BE
 */

/* === Variables couleurs === */
:root {
    --primary: #1a5276;
    --primary-light: #2980b9;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
    --bg: #f5f6f8;
    --text: #2c3e50;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* === Reset & Base === */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* Cacher les éléments Alpine non initialisés */
[x-cloak] { display: none !important; }

/* === Bootstrap overrides === */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}
.text-primary { color: var(--primary) !important; }

/* === Écran Login === */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.login-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 2.2rem;
}

/* === Layout écrans (post-login) === */
.app-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.app-screen.has-bottom-nav {
    padding-bottom: 70px;
}

.screen-header {
    background: #fff;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 10;
}
.screen-header.compact {
    padding: 0.75rem 1.25rem;
}

.screen-body {
    flex: 1;
    padding: 1rem 1.25rem;
    overflow-y: auto;
}

/* === Barre de navigation bottom === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    z-index: 100;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    border: none;
    background: none;
    color: #6c757d;
    font-size: 0.7rem;
    padding: 0.35rem 1rem;
    cursor: pointer;
    transition: color 0.2s;
}
.bottom-nav-item i {
    font-size: 1.3rem;
}
.bottom-nav-item.active {
    color: var(--primary);
    font-weight: 600;
}
.bottom-nav-item:active {
    color: var(--primary-light);
}

/* === Cards événements === */
.event-card {
    cursor: pointer;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.15s, box-shadow 0.15s;
}
.event-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.scan-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

/* === Badges partenaires === */
.badge-gold {
    background: #f1c40f !important;
    color: #2c3e50 !important;
}
.badge-silver {
    background: #95a5a6 !important;
    color: #fff !important;
}
.badge-asso {
    background: #3498db !important;
    color: #fff !important;
}
.badge-orga {
    background: #8e44ad !important;
    color: #fff !important;
}

/* === Scanner === */
.scanner-body {
    padding: 0;
}

.scanner-container {
    position: relative;
    background: #1a1a2e;
}

.scanner-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: #1a1a2e;
    color: #6c757d;
}

/* Styles html5-qrcode */
#reader {
    width: 100%;
    border: none !important;
}
#reader video {
    border-radius: 0 !important;
    width: 100% !important;
    object-fit: cover !important;
}
/* Masquer les éléments UI par défaut de html5-qrcode */
#reader__scan_region {
    min-height: 250px;
}
#reader__dashboard {
    padding: 0.5rem !important;
}
#reader__dashboard_section {
    padding: 0 !important;
}
#reader__dashboard_section_swaplink {
    color: var(--primary-light) !important;
    text-decoration: underline !important;
    font-size: 0.85rem !important;
}
/* Masquer le header "Scanning" par défaut */
#reader__header_message {
    display: none !important;
}
/* Réduire les boutons de permission */
#reader__camera_permission_button {
    background: var(--primary) !important;
    border: none !important;
    border-radius: 0.5rem !important;
    padding: 0.75rem 1.5rem !important;
    font-size: 1rem !important;
}

/* === Bannière statut réseau === */
.network-banner {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    text-align: center;
    font-weight: 500;
}
.network-banner.offline {
    background: #fff3cd;
    color: #856404;
    border-bottom: 1px solid #ffeeba;
}
.network-banner.syncing {
    background: #d1ecf1;
    color: #0c5460;
    border-bottom: 1px solid #bee5eb;
}

/* === Badge pending (navbar) === */
.pending-badge {
    position: absolute;
    top: -6px;
    right: -10px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* === Feedback scan === */
.scan-feedback {
    margin: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    animation: feedbackSlideIn 0.25s ease-out;
}

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

.feedback-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.feedback-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}
.feedback-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}
.feedback-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}
.feedback-offline {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

/* === Contacts === */
.contacts-body {
    padding: 0.75rem;
}

.contact-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--card-shadow);
}

/* === Profil === */
.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
}

/* === Utilitaires === */
.spin {
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Responsive desktop === */
@media (min-width: 768px) {
    .login-card {
        padding: 2.5rem;
    }
    .app-screen {
        max-width: 600px;
        margin: 0 auto;
    }
    .bottom-nav {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 1rem 1rem 0 0;
    }
}
