/* =====================================================
   SURF SPOT - Main Stylesheet
   Modern, Performant, Accessible
   ===================================================== */

/* === Variables CSS === */
:root {
    --primary-color: #5271ff;
    --secondary-color: #5ce1e6;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --dark-color: #1a1a2e;
    --light-color: #f8f9fa;

    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --transition-speed: 0.3s;
    --border-radius: 8px;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --box-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* === Global Styles === */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    color: #333;
    line-height: 1.6;
    padding-bottom: 60px; /* Pour la tap-bar */
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.text-primary {
    color: var(--primary-color) !important;
}

/* === Links === */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

a:hover {
    color: darken(var(--primary-color), 10%);
}

/* === Buttons === */
.btn {
    border-radius: var(--border-radius);
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    transition: all var(--transition-speed) ease;
    border: none;
}

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

.btn:active {
    transform: translateY(0);
}

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

.btn-primary:hover {
    background: #3d5ce3;
}

/* === Cards === */
.card {
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all var(--transition-speed) ease;
}

.card-img-top {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* === Navbar === */
.navbar {
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95) !important;
    transition: all var(--transition-speed) ease;
}

.navbar.scrolled {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

/* === Autocomplete === */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    max-height: 350px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--box-shadow-hover);
    margin-top: 2px;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background var(--transition-speed) ease;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: #f8f9fa;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.hover-bg:hover {
    background-color: #f8f9fa;
}

/* === Toast Notifications === */
.toast-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    padding: 16px 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-hover);
    z-index: 10000;
    animation: slideIn var(--transition-speed) ease;
    max-width: 350px;
    min-width: 250px;
}

.toast-notification.success {
    border-left: 4px solid var(--success-color);
}

.toast-notification.error {
    border-left: 4px solid var(--danger-color);
}

.toast-notification.info {
    border-left: 4px solid var(--info-color);
}

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

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* === Loading States === */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === Accessibility === */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.visually-hidden-focusable:focus {
    position: fixed !important;
    top: 10px !important;
    left: 10px !important;
    width: auto !important;
    height: auto !important;
    padding: 10px 20px !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    background: var(--primary-color) !important;
    color: white !important;
    z-index: 10001 !important;
    border-radius: var(--border-radius) !important;
    font-weight: bold !important;
}

/* === Responsive === */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2rem !important;
    }

    .hero-section .lead {
        font-size: 1rem !important;
    }

    .navbar-brand img {
        height: 30px !important;
    }

    body {
        padding-bottom: 70px; /* Plus d'espace pour la tap-bar sur mobile */
    }
}

/* === PWA Install Prompt === */
#install-prompt {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #fff;
    padding: 15px 20px;
    border: 1px solid #ddd;
    box-shadow: var(--box-shadow-hover);
    border-radius: var(--border-radius);
    z-index: 9999;
    max-width: 400px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* === Chatbot === */
#chatbot-window {
    max-height: 600px;
    overflow: hidden;
}

#chatbot-result {
    font-size: 14px;
}

#chatbot-toggle button {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* === Utilities === */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.shadow-sm-hover:hover {
    box-shadow: var(--box-shadow) !important;
}

/* === Print Styles === */
@media print {
    .navbar,
    .tap-bar,
    #chatbot-window,
    #install-prompt,
    .toast-notification {
        display: none !important;
    }
}

/* === Performance Optimizations === */
.card-img-top,
img {
    content-visibility: auto;
}

/* Utiliser GPU pour les animations */
.hover-lift,
.btn,
.card {
    will-change: transform;
    transform: translateZ(0);
}

