/* =============================================================================
   ClickClockGo Scanner - Feuille de styles
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Variables CSS
   ----------------------------------------------------------------------------- */
:root {
    /* Couleurs principales */
    --primary-blue: #007BFF;
    --success-green: #2ECC71;
    --danger-red: #e74c3c;
    --warning-orange: #f39c12;
    
    /* Couleurs neutres */
    --bg-light: #F4F4F4;
    --bg-white: #FFFFFF;
    --text-dark: #1A1A1A;
    --text-gray: #707070;
    --border-light: #E0E0E0;
    
    /* Ombres */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
    
    /* Espacements */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Bordures */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

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

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background-color: var(--bg-light);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* -----------------------------------------------------------------------------
   Typographie
   ----------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    line-height: 1.2;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
}

/* -----------------------------------------------------------------------------
   Header
   ----------------------------------------------------------------------------- */
.header {
    background: var(--bg-white);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.5rem;
    font-weight: 700;
    user-select: none;
}

.logo-icon {
    width: 40px;
    height: 40px;
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* -----------------------------------------------------------------------------
   Container
   ----------------------------------------------------------------------------- */
.container {
    flex: 1;
    padding: var(--spacing-lg);
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* -----------------------------------------------------------------------------
   États
   ----------------------------------------------------------------------------- */
.state-container {
    display: none;
    opacity: 0;
}

.state-container.active {
    display: block;
    opacity: 1;
    animation: fadeIn var(--transition-normal);
}

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

/* -----------------------------------------------------------------------------
   Cards
   ----------------------------------------------------------------------------- */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-lg);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* -----------------------------------------------------------------------------
   Asset info
   ----------------------------------------------------------------------------- */
.asset-name {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    color: var(--text-dark);
}

#rental-state .asset-name {
    text-align: center !important;
    margin-bottom: 1.2em;
}

.asset-description {
    font-size: 1rem;
    color: var(--text-gray);
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
}

/* -----------------------------------------------------------------------------
   Pricing
   ----------------------------------------------------------------------------- */
.pricing-title {
    margin-bottom: var(--spacing-md);
    font-size: 1.125rem;
    color: var(--text-dark);
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
}

.price-item {
    background: var(--bg-light);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    text-align: center;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.price-item:hover {
    background: rgba(0, 123, 255, 0.05);
    border-color: rgba(0, 123, 255, 0.2);
}

.price-item.active {
    border-color: var(--primary-blue);
    background: rgba(0, 123, 255, 0.05);
    transform: scale(1.05);
}

.price-label {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-bottom: var(--spacing-xs);
}

.price-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

/* -----------------------------------------------------------------------------
   Timer
   ----------------------------------------------------------------------------- */
.timer-container {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.timer {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary-blue);
    font-variant-numeric: tabular-nums;
    letter-spacing: -2px;
    line-height: 1;
    margin-bottom: var(--spacing-sm);
    text-shadow: 0 2px 4px rgba(0, 123, 255, 0.1);
}

.current-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--success-green);
    margin-bottom: var(--spacing-xs);
}

.next-tier-info {
    font-size: 0.875rem;
    color: var(--text-gray);
}

/* -----------------------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------------------- */
.button {
    width: 100%;
    min-height: 64px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.125rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    position: relative;
    overflow: hidden;
    background-image: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
    background-size: 200% 100%;
    background-position: -100% 0;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background-position: 100% 0;
}

.button:active {
    transform: scale(0.98);
}

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.button svg {
    width: 24px;
    height: 24px;
}

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

.button-primary:hover {
    background-color: #0056b3;
}

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

.button-success:hover {
    background-color: #27ae60;
}

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

.button-danger:hover {
    background-color: #c0392b;
}

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

.button-secondary:hover {
    background-color: #95a5a6;
}

/* -----------------------------------------------------------------------------
   Modal
   ----------------------------------------------------------------------------- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 100;
    padding: var(--spacing-lg);
    backdrop-filter: blur(8px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    max-width: 400px;
    width: 100%;
    animation: slideUp var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

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

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    text-align: center;
    color: var(--text-dark);
}

/* -----------------------------------------------------------------------------
   PIN Input
   ----------------------------------------------------------------------------- */
.pin-input-container {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    margin-bottom: var(--spacing-lg);
}

.pin-digit {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--transition-fast);
    background: var(--bg-light);
    -webkit-text-security: disc;
}

/* Fallback pour les navigateurs sans support webkit */
@supports not (-webkit-text-security: disc) {
    .pin-digit {
        color: transparent;
        text-shadow: 0 0 0 #000;
    }
    
    .pin-digit:focus {
        color: transparent;
        text-shadow: 0 0 0 #000;
    }
}

.pin-digit:focus {
    border-color: var(--primary-blue);
    background: rgba(0, 123, 255, 0.05);
    transform: scale(1.05);
}

.pin-digit.filled {
    background: var(--text-dark);
    color: white;
    border-color: var(--text-dark);
}

.pin-digit::-webkit-inner-spin-button,
.pin-digit::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.modal-buttons {
    display: flex;
    gap: var(--spacing-sm);
}

.modal-buttons .button {
    flex: 1;
}

/* -----------------------------------------------------------------------------
   Messages
   ----------------------------------------------------------------------------- */
.error-message {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid var(--danger-red);
    color: var(--danger-red);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-lg);
    font-size: 0.875rem;
    text-align: center;
    animation: shake var(--transition-fast);
}

.info-message {
    background: rgba(0, 123, 255, 0.1);
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-lg);
    font-size: 0.875rem;
    text-align: center;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* -----------------------------------------------------------------------------
   Success state
   ----------------------------------------------------------------------------- */
.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-lg);
    background: var(--success-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn var(--transition-normal);
}

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

.success-icon svg {
    width: 40px;
    height: 40px;
    stroke: white;
    stroke-width: 3;
}

.success-title {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    color: var(--text-dark);
}

.final-price {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.final-price-label {
    font-size: 1.125rem;
    color: var(--text-gray);
    margin-bottom: var(--spacing-xs);
}

.final-price-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--success-green);
    text-shadow: 0 2px 4px rgba(46, 204, 113, 0.1);
}

.final-duration {
    font-size: 1rem;
    color: var(--text-gray);
    margin-top: var(--spacing-xs);
}

/* -----------------------------------------------------------------------------
   Loading
   ----------------------------------------------------------------------------- */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* -----------------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .container {
        padding: var(--spacing-md);
    }
    
    .asset-name {
        font-size: 1.5rem;
    }

    #rental-state .asset-name {
        text-align: center !important;
        margin-bottom: 1.2em;
    }
    
    .timer {
        font-size: 3rem;
    }
    
    .current-price {
        font-size: 1.75rem;
    }
    
    .final-price-value {
        font-size: 2.5rem;
    }
    
    .pricing-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .pin-digit {
        width: 50px;
        height: 50px;
    }
}

/* Mode paysage */
@media (orientation: landscape) and (max-height: 600px) {
    .header {
        position: relative;
        padding: var(--spacing-sm) var(--spacing-lg);
    }
    
    .container {
        padding: var(--spacing-sm) var(--spacing-lg);
    }
    
    .card {
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-md);
    }
    
    .timer {
        font-size: 3rem;
    }
    
    .button {
        min-height: 56px;
    }
}

/* Écrans haute résolution */
@media (min-width: 768px) {
    .container {
        padding: var(--spacing-xl);
    }
    
    .card {
        padding: var(--spacing-xl);
    }
}

/* Impression */
@media print {
    body {
        background: white;
    }
    
    .header,
    .button,
    .modal {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border-light);
    }
}

/* -----------------------------------------------------------------------------
   Animations supplémentaires
   ----------------------------------------------------------------------------- */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* -----------------------------------------------------------------------------
   Accessibilité
   ----------------------------------------------------------------------------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible pour la navigation clavier */
:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Mode sombre (à implémenter si nécessaire) */
@media (prefers-color-scheme: dark) {
    /* Variables pour le mode sombre */
}

/* Réduction des animations si demandé */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}