/**
 * Delta Immobilier - Frontend Styles
 * Site public vitrine
 */

/* =======================
   Variables CSS Tailwind / Shadcn
   ======================= */
:root {
    /* Tailwind Semantic Colors (HSL format) */
    --background: 0 0% 100%;
    --foreground: 240 4% 11%;

    --card: 0 0% 100%;
    --card-foreground: 240 4% 11%;

    --popover: 0 0% 100%;
    --popover-foreground: 240 4% 11%;

    --primary: 211 100% 52%;
    --primary-foreground: 0 0% 100%;

    --secondary: 240 4% 11%;
    --secondary-foreground: 0 0% 97%;

    --muted: 0 0% 97%;
    --muted-foreground: 240 4% 46%;

    --accent: 0 0% 97%;
    --accent-foreground: 240 4% 11%;

    --destructive: 0 84% 60%;
    --destructive-foreground: 0 0% 100%;

    --border: 0 0% 90%;
    --input: 0 0% 90%;
    --ring: 211 100% 52%;

    --radius: 0.75rem;

    /* Glass effect variables */
    --glass-bg: 255 255 255 / .75;
    --glass-border: 255 255 255 / .18;
    --glass-shadow: 0 0 0 / .1;

    /* Gradients */
    --gradient-hero: linear-gradient(135deg, hsl(211 100% 52% / .9), hsl(240 4% 11% / .8));
    --gradient-glass: linear-gradient(135deg, hsl(0 0% 97% / .4), hsl(0 0% 100% / .2));
    --gradient-footer: linear-gradient(145deg, hsl(240 4% 11% / .95), hsl(240 4% 20% / .85));

    /* Transitions and effects */
    --transition-smooth: all .3s cubic-bezier(.4, 0, .2, 1);
    --blur-glass: blur(12px);
    --shadow-elegant: 0 10px 30px -10px hsl(211 100% 52% / .2);
    --shadow-glass: 0 8px 32px hsl(0 0 0 / .1);

    /* Old Colors (legacy compatibility) */
    --color-primary: #2563EB;
    --color-primary-dark: #1E40AF;
    --color-secondary: #10B981;
    --color-accent: #F59E0B;
    --color-danger: #EF4444;

    /* Grays */
    --color-gray-50: #F9FAFB;
    --color-gray-100: #F3F4F6;
    --color-gray-200: #E5E7EB;
    --color-gray-300: #D1D5DB;
    --color-gray-400: #9CA3AF;
    --color-gray-500: #6B7280;
    --color-gray-600: #4B5563;
    --color-gray-700: #374151;
    --color-gray-800: #1F2937;
    --color-gray-900: #111827;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --shadow-elegant: 0 20px 60px -10px rgba(0, 0, 0, 0.15);

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 300ms ease-in-out;
    --transition-slow: 500ms ease-in-out;
}

/* Dark mode (optional) */
.dark {
    --background: 240 4% 11%;
    --foreground: 0 0% 97%;

    --card: 240 4% 13%;
    --card-foreground: 0 0% 97%;

    --popover: 240 4% 13%;
    --popover-foreground: 0 0% 97%;

    --primary: 211 100% 52%;
    --primary-foreground: 0 0% 100%;

    --secondary: 240 4% 16%;
    --secondary-foreground: 0 0% 97%;

    --muted: 240 4% 16%;
    --muted-foreground: 0 0% 65%;

    --accent: 240 4% 16%;
    --accent-foreground: 0 0% 97%;

    --destructive: 0 84% 60%;
    --destructive-foreground: 0 0% 100%;

    --border: 240 4% 20%;
    --input: 240 4% 20%;
    --ring: 211 100% 52%;

    /* Glass effect variables for dark mode */
    --glass-bg: 28 28 30 / .75;
    --glass-border: 255 255 255 / .08;
    --glass-shadow: 0 0 0 / .2;

    /* Gradients for dark mode */
    --gradient-hero: linear-gradient(135deg, hsl(211 100% 52% / .9), hsl(240 4% 11% / .95));
    --gradient-glass: linear-gradient(135deg, hsl(240 4% 16% / .6), hsl(240 4% 20% / .4));
    --gradient-footer: linear-gradient(145deg, hsl(240 4% 8% / .95), hsl(240 4% 15% / .85));
}

/* =======================
   Base Styles
   ======================= */
*,
*::before,
*::after {
    box-sizing: border-box;
    border-color: hsl(var(--border));
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
}

/* =======================
   Tailwind Utility Classes
   ======================= */

/* Background colors */
.bg-background {
    background-color: hsl(var(--background));
}

.bg-foreground {
    background-color: hsl(var(--foreground));
}

.bg-card {
    background-color: hsl(var(--card));
}

.bg-primary {
    background-color: hsl(var(--primary));
}

.bg-primary\/10 {
    background-color: hsl(var(--primary) / 0.1);
}

.bg-secondary {
    background-color: hsl(var(--secondary));
}

.bg-muted {
    background-color: hsl(var(--muted));
}

.bg-muted\/30 {
    background-color: hsl(var(--muted) / 0.3);
}

.bg-accent {
    background-color: hsl(var(--accent));
}

.bg-destructive {
    background-color: hsl(var(--destructive));
}

.bg-background\/50 {
    background-color: hsl(var(--background) / 0.5);
}

/* Text colors */
.text-foreground {
    color: hsl(var(--foreground));
}

.text-background {
    color: hsl(var(--background));
}

.text-card-foreground {
    color: hsl(var(--card-foreground));
}

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

.text-primary-foreground {
    color: hsl(var(--primary-foreground));
}

.text-secondary {
    color: hsl(var(--secondary));
}

.text-secondary-foreground {
    color: hsl(var(--secondary-foreground));
}

.text-muted {
    color: hsl(var(--muted));
}

.text-muted-foreground {
    color: hsl(var(--muted-foreground));
}

.text-accent {
    color: hsl(var(--accent));
}

.text-accent-foreground {
    color: hsl(var(--accent-foreground));
}

.text-destructive {
    color: hsl(var(--destructive));
}

.text-destructive-foreground {
    color: hsl(var(--destructive-foreground));
}

/* Border colors */
.border-border {
    border-color: hsl(var(--border));
}

.border-border\/30 {
    border-color: hsl(var(--border) / 0.3);
}

.border-border\/50 {
    border-color: hsl(var(--border) / 0.5);
}

.border-input {
    border-color: hsl(var(--input));
}

/* Ring colors */
.ring-ring {
    --tw-ring-color: hsl(var(--ring));
}

.ring-offset-background {
    --tw-ring-offset-color: hsl(var(--background));
}

/* Hover states */
.hover\:bg-primary:hover {
    background-color: hsl(var(--primary));
}

.hover\:bg-primary\/90:hover {
    background-color: hsl(var(--primary) / 0.9);
}

.hover\:bg-primary\/10:hover {
    background-color: hsl(var(--primary) / 0.1);
}

.hover\:bg-accent:hover {
    background-color: hsl(var(--accent));
}

.hover\:bg-white\/90:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

.hover\:text-primary:hover {
    color: hsl(var(--primary));
}

.hover\:text-accent-foreground:hover {
    color: hsl(var(--accent-foreground));
}

/* Shadow utilities */
.shadow-elegant {
    box-shadow: var(--shadow-elegant);
}

/* =======================
   Utility Classes
   ======================= */
.container {
    width: 100%;
    margin-right: auto;
    margin-left: auto;
    padding-right: 2rem;
    padding-left: 2rem;
}

@media (min-width: 1400px) {
    .container {
        max-width: 1400px !important;
    }
}

/* Glass effect */
.glass {
    background: rgba(var(--glass-bg));
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid rgba(var(--glass-border));
    box-shadow: var(--shadow-glass);
}

/* Smooth transitions */
.transition-smooth {
    transition: var(--transition-smooth);
}

/* =======================
   Custom Switch Styles (Sprint 2)
   ======================= */
/* Switch container styling */
input[type="checkbox"].peer {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 0.125rem !important;
}

/* Switch background - unchecked state */
input[type="checkbox"].peer {
    background-color: hsl(var(--input)) !important;
}

/* Switch background - checked state */
input[type="checkbox"].peer:checked {
    background-color: hsl(var(--primary)) !important;
}

/* Switch thumb (white circle) */
input[type="checkbox"].peer::before {
    content: '' !important;
    position: absolute !important;
    height: 1.25rem !important;
    width: 1.25rem !important;
    border-radius: 9999px !important;
    background-color: hsl(var(--background)) !important;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1) !important;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    /*left: 0.125rem !important;*/
}

/* Switch thumb - checked position */
input[type="checkbox"].peer:checked::before {
    transform: translateX(1.25rem) !important;
}

/* Hover elevate */
.hover-elevate {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-elevate:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* =======================
   Animations
   ======================= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(2deg);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

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

/* =======================
   Components
   ======================= */

/* Property Cards */
.property-card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.property-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.property-card-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.property-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all var(--transition-normal);
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    box-shadow: 0 10px 30px -10px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    box-shadow: 0 15px 40px -10px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
    background-color: white;
    color: var(--color-gray-700);
    border: 1px solid var(--color-gray-300);
}

.btn-secondary:hover {
    background-color: var(--color-gray-50);
}

/* =======================
   Hero Section
   ======================= */
.hero-section {
    position: relative;
    min-height: 600px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-background {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-background img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0.95),
        rgba(255, 255, 255, 0.85),
        rgba(255, 255, 255, 0.6)
    );
}

.hero-content {
    position: relative;
    z-index: 10;
}

/* =======================
   Search Bar
   ======================= */
.search-bar {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-xl);
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-gray-300);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* =======================
   Responsive
   ======================= */
@media (max-width: 768px) {
    .property-card-image {
        height: 200px;
    }

    .hero-section {
        min-height: 500px;
    }
}

/* =======================
   Loading States
   ======================= */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 3px solid var(--color-gray-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.6s linear infinite;
}

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

.bg-gradient-to-br {
    background-image: linear-gradient(to bottom right, var(--tw-gradient-stops));
}
.from-primary\/10 {
    --tw-gradient-from: hsl(var(--primary) / .1) var(--tw-gradient-from-position);
    --tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
}
.via-accent {
    --tw-gradient-to: hsl(var(--accent) / 0) var(--tw-gradient-to-position);
    --tw-gradient-stops: var(--tw-gradient-from), hsl(var(--accent)) var(--tw-gradient-via-position), var(--tw-gradient-to);
}
.to-primary\/5 {
    --tw-gradient-to: hsl(var(--primary) / .05) var(--tw-gradient-to-position);
}
.glass {
    background: rgba(var(--glass-bg)) !important;
    backdrop-filter: var(--blur-glass) !important;
    -webkit-backdrop-filter: var(--blur-glass) !important;
    border: 1px solid rgba(var(--glass-border)) !important;
    box-shadow: var(--shadow-glass) !important;
}
.data-\[state\=unchecked\]\:bg-input[data-state=unchecked] {
    background-color: hsl(var(--input));
}
.border-primary {
    border-color: hsl(var(--primary));
}
.ring-primary {
    --tw-ring-color: hsl(var(--primary));
}
.bg-primary\/10 {
    background-color: hsl(var(--primary) / .1);
}
.text-primary {
    color: hsl(var(--primary));
}
.rounded-lg {
    border-radius: var(--radius) !important;
}
.hover\:bg-primary\/10:hover {
    background-color: hsl(var(--primary) / .1) !important;
}
.transition-smooth {
    transition: var(--transition-smooth) !important;
}
input::-moz-placeholder, textarea::-moz-placeholder {
    opacity: 1;
    color: #9ca3af
}
input::placeholder, textarea::placeholder {
    opacity: 1;
    color: #9ca3af
}
.placeholder\:text-muted-foreground::-moz-placeholder {
    color: hsl(var(--muted-foreground))
}
.placeholder\:text-muted-foreground::placeholder {
    color: hsl(var(--muted-foreground))
}

/* =======================
   Form Input Styles (Tailwind Forms plugin replacement)
   ======================= */
.form-input,
.form-textarea,
.form-select {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: hsl(var(--foreground));
    background-color: hsl(var(--background));
    background-clip: padding-box;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    appearance: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #9ca3af;
    opacity: 1;
}

.form-input:disabled,
.form-textarea:disabled,
.form-select:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.7;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.form-checkbox,
.form-radio {
    appearance: none;
    display: inline-block;
    width: 1rem;
    height: 1rem;
    background-color: #fff;
    border: 1px solid #d1d5db;
    vertical-align: middle;
    cursor: pointer;
}

.form-checkbox {
    border-radius: 0.25rem;
}

.form-radio {
    border-radius: 50%;
}

.form-checkbox:checked,
.form-radio:checked {
    background-color: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

.form-checkbox:checked {
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
}

.form-radio:checked {
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
}

.form-checkbox:focus,
.form-radio:focus {
    outline: none;
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

/* =======================
   Peer-checked states (for custom checkbox/radio UI)
   ======================= */
.peer:checked ~ .peer-checked\:bg-primary {
    background-color: hsl(var(--primary));
}

.peer:checked ~ .peer-checked\:text-white {
    color: white;
}

.peer:checked ~ .peer-checked\:border-primary {
    border-color: hsl(var(--primary));
}

.peer:checked ~ .peer-checked\:text-primary {
    color: hsl(var(--primary));
}

.peer:checked ~ .peer-checked\:bg-blue-50 {
    background-color: rgb(239 246 255);
}

.peer:checked ~ .peer-checked\:bg-primary\/10 {
    background-color: hsl(var(--primary) / 0.1);
}

/* =======================
   Favorite Button Styles
   ======================= */
.favorite-btn {
    transition: all 0.3s ease;
}

.favorite-btn svg {
    transition: all 0.3s ease;
}

.favorite-btn:hover svg {
    transform: scale(1.1);
}

.favorite-btn.active svg {
    fill: #ef4444;
    stroke: #ef4444;
}

.favorite-btn.active {
    background: rgba(239, 68, 68, 0.15) !important;
}

.favorite-btn:hover:not(.active) svg {
    stroke: #ef4444;
}

/* =======================
   Symfony Form Error Styles
   ======================= */
.form-error-message,
ul.form-errors li,
.invalid-feedback {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

ul.form-errors {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Error state for inputs */
.is-invalid,
input.is-invalid,
textarea.is-invalid,
select.is-invalid {
    border-color: #ef4444 !important;
}

/* Focus state with error */
.is-invalid:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}
