/**
 * Styles personnalisés - Colocation Standing Rouen
 * Animations et composants custom
 */

/* === Variables CSS === */
:root {
    --primary: #b8a89a;
    --secondary: #5d7b7e;
    --accent: #e8a87c;
    --dark: #1a1a1a;
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Oxygen,
        Ubuntu,
        Cantarell,
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Animations === */

/* Fade in up */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s var(--transition-smooth) forwards;
}

/* Slide in from left */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s var(--transition-smooth) forwards;
}

/* Slide in from right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in-right {
    animation: slideInRight 0.6s var(--transition-smooth) forwards;
}

/* Scale in */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-in {
    animation: scaleIn 0.4s var(--transition-smooth) forwards;
}

/* Pulse */
@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Float */
@keyframes float {
    0%,
    100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* === Carte d'appartement === */
.apartment-card {
    transition: all 0.5s var(--transition-smooth);
}

.apartment-card:hover {
    transform: translateY(-8px);
}

.apartment-card img {
    transition: transform 0.7s var(--transition-smooth);
}

.apartment-card:hover img {
    transform: scale(1.1);
}

/* === Line clamp (limitation du texte) === */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === Carousel === */
.carousel {
    position: relative;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    transition: transform 0.5s var(--transition-smooth);
}

.carousel-slide {
    min-width: 100%;
    transition: opacity 0.5s var(--transition-smooth);
}

.carousel-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s var(--transition-smooth);
    z-index: 10;
}

.carousel-button:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.carousel-button.prev {
    left: 16px;
}

.carousel-button.next {
    right: 16px;
}

.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all 0.3s var(--transition-smooth);
}

.carousel-indicator.active {
    width: 24px;
    border-radius: 4px;
    background: white;
}

/* === Lightbox === */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s var(--transition-smooth);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    transform: scale(0.9);
    transition: transform 0.3s var(--transition-smooth);
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--transition-smooth);
}

.lightbox-close:hover {
    transform: scale(1.1);
    background: #f0f0f0;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--transition-smooth);
    z-index: 10000;
}

.lightbox-nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
}

.thumbnail {
    cursor: pointer;
    transition: all 0.2s var(--transition-smooth);
}

/* === Formulaire === */
.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.2s var(--transition-smooth);
    background: white;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(93, 123, 126, 0.1);
}

.form-input.error,
.form-textarea.error,
.form-select.error {
    border-color: #ef4444;
}

.form-error {
    color: #ef4444;
    font-size: 14px;
    margin-top: 4px;
}

.form-loading {
    pointer-events: none;
    opacity: 0.6;
}

/* === Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* === Loading Spinner === */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* === Utilities === */
.backdrop-blur {
    backdrop-filter: blur(10px);
}

.glass-effect {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Smooth transitions globales */
* {
    transition-timing-function: var(--transition-smooth);
}

/* === Responsive === */

/* Tablets */
@media (max-width: 768px) {
    .carousel-button {
        width: 40px;
        height: 40px;
    }

    .carousel-button.prev {
        left: 8px;
    }

    .carousel-button.next {
        right: 8px;
    }

    .lightbox-content {
        max-width: 95vw;
        max-height: 85vh;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .apartment-card {
        margin-bottom: 20px;
    }

    .carousel-button {
        width: 36px;
        height: 36px;
    }

    .form-input,
    .form-textarea {
        font-size: 16px; /* Évite le zoom sur iOS */
    }
}

/* === Accessibilité === */

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

/* Réduire les animations pour les utilisateurs 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;
    }
}

/* === Print === */
@media print {
    .no-print {
        display: none !important;
    }

    * {
        background: white !important;
        color: black !important;
    }
}
