/* ========================================
   GoRent AG - Main Layout Styles
   Modern Light/Dark Theme Support
   ======================================== */

/* Base custom styles that extend Tailwind */
@layer base {
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
    }
    
    /* Custom scrollbar - Dark Mode */
    ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }
    
    ::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 5px;
    }
    
    ::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, rgba(167, 255, 58, 0.4), rgba(65, 211, 106, 0.3));
        border-radius: 5px;
        border: 2px solid transparent;
        background-clip: padding-box;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(180deg, rgba(167, 255, 58, 0.6), rgba(65, 211, 106, 0.5));
        border: 2px solid transparent;
        background-clip: padding-box;
    }
    
    /* Light mode scrollbar */
    [data-theme="light"] ::-webkit-scrollbar-track {
        background: rgba(15, 23, 42, 0.05);
    }
    
    [data-theme="light"] ::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, rgba(167, 255, 58, 0.5), rgba(65, 211, 106, 0.4));
        border: 2px solid transparent;
        background-clip: padding-box;
    }
    
    [data-theme="light"] ::-webkit-scrollbar-thumb:hover {
        background: linear-gradient(180deg, rgba(167, 255, 58, 0.7), rgba(65, 211, 106, 0.6));
        border: 2px solid transparent;
        background-clip: padding-box;
    }
}

@layer components {
    /* Card hover effects */
    .card-hover {
        @apply transition-all duration-300;
    }
    
    .card-hover:hover {
        @apply -translate-y-1 shadow-xl;
    }
    
    /* Gradient text */
    .text-gradient {
        @apply bg-gradient-to-br from-[#a7ff3a] to-[#41d36a] bg-clip-text text-transparent;
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        color: transparent;
        /* Ensure gradient respects line-height and wraps correctly */
        display: inline-block;
        background-repeat: no-repeat;
        background-position: 0 0;
        background-size: 100% 100%;
    }
    /* Force browser-prefixed clip and fill for Tailwind utility usage */
    .bg-clip-text {
        -webkit-background-clip: text !important;
        background-clip: text !important;
        -webkit-text-fill-color: transparent !important;
        /* Ensure the gradient is clipped to the glyphs and not shown as a full rectangle */
        display: inline-block !important;
        background-repeat: no-repeat !important;
        background-position: 0 0 !important;
        background-size: 100% 100% !important;
    }
    
    /* Glow effects */
    .glow-accent {
        box-shadow: 0 0 40px rgba(167, 255, 58, 0.15);
    }
    
    .glow-accent-lg {
        box-shadow: 0 0 60px rgba(167, 255, 58, 0.25);
    }
    
    /* Button shine animation */
    .btn-shine {
        @apply relative overflow-hidden;
    }
    
    .btn-shine::after {
        content: '';
        @apply absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent -translate-x-full;
        animation: shine 3s ease-in-out infinite;
    }
    
    @keyframes shine {
        0% { transform: translateX(-100%); }
        50%, 100% { transform: translateX(100%); }
    }
    
    /* FAQ Accordion */
    .faq-item .faq-answer {
        @apply max-h-0 overflow-hidden transition-all duration-300;
    }
    
    .faq-item.active .faq-answer {
        @apply max-h-96;
    }
    
    .faq-item.active button i {
        @apply rotate-45;
    }
    
    /* Scroll reveal animations */
    .scroll-reveal {
        @apply opacity-0 translate-y-5 transition-all duration-700;
    }
    
    .scroll-reveal.visible {
        @apply opacity-100 translate-y-0;
    }
    
    .scroll-reveal.fade-left {
        @apply translate-x-5 translate-y-0;
    }
    
    .scroll-reveal.fade-right {
        @apply -translate-x-5 translate-y-0;
    }
    
    /* Brand chips */
    .brand-chip {
        @apply inline-flex items-center gap-3 px-5 py-3 bg-white/5 border border-white/10 rounded-full
               font-semibold transition-all duration-300 hover:border-accent hover:bg-accent/10 hover:-translate-y-0.5;
    }
    
    [data-theme="light"] .brand-chip {
        @apply bg-white/80 border-gray-200 hover:border-accent;
    }
}

@layer utilities {
    /* Animation delays */
    .animation-delay-100 { animation-delay: 100ms; }
    .animation-delay-200 { animation-delay: 200ms; }
    .animation-delay-300 { animation-delay: 300ms; }
    .animation-delay-500 { animation-delay: 500ms; }
    .animation-delay-700 { animation-delay: 700ms; }
    .animation-delay-1000 { animation-delay: 1000ms; }
    
    /* Backdrop blur support */
    .backdrop-blur-xs {
        backdrop-filter: blur(2px);
    }
}

/* ========================================
   Light Mode - Comprehensive Overrides
   ======================================== */
[data-theme="light"] {
    --text-primary: rgba(15, 23, 42, 0.95);
    --text-secondary: rgba(15, 23, 42, 0.7);
    --text-muted: rgba(15, 23, 42, 0.5);
    --bg-glass: rgba(255, 255, 255, 0.75);
    --border-color: rgba(15, 23, 42, 0.08);
    --accent-color: #22c55e;
    --accent-hover: #16a34a;
}

/* Light Mode - Darker Accent Colors for Better Visibility */
[data-theme="light"] .text-accent,
[data-theme="light"] .fa-clock.text-accent,
[data-theme="light"] .fa-envelope.text-accent,
[data-theme="light"] .fa-phone.text-accent,
[data-theme="light"] .fa-location-dot.text-accent,
[data-theme="light"] .fa-bolt.text-accent,
[data-theme="light"] .fa-car-side.text-accent,
[data-theme="light"] .fa-magnifying-glass.text-accent,
[data-theme="light"] .fa-calendar.text-accent,
[data-theme="light"] .fa-calendar-check.text-accent,
[data-theme="light"] .fa-calendar-days.text-accent,
[data-theme="light"] .fa-gauge-high.text-accent,
[data-theme="light"] .fa-car.text-accent,
[data-theme="light"] .fa-key.text-accent,
[data-theme="light"] .fa-shield-halved.text-accent,
[data-theme="light"] .fa-star.text-accent,
[data-theme="light"] .fa-leaf.text-accent,
[data-theme="light"] .fa-headset.text-accent,
[data-theme="light"] .fa-check.text-accent,
[data-theme="light"] .fa-chevron-right.text-accent,
[data-theme="light"] .fa-paper-plane.text-accent,
[data-theme="light"] .fa-heart.text-accent,
[data-theme="light"] .fa-info-circle.text-accent,
[data-theme="light"] .fa-file-contract.text-accent,
[data-theme="light"] .fa-gavel.text-accent,
[data-theme="light"] i.text-accent {
    color: #22c55e !important;
}

[data-theme="light"] .section-tag {
    color: #22c55e !important;
}

[data-theme="light"] .text-gradient {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

[data-theme="light"] .bg-accent\/10,
[data-theme="light"] .bg-accent\/15 {
    background: rgba(34, 197, 94, 0.1) !important;
}

[data-theme="light"] .border-accent\/20,
[data-theme="light"] .border-accent\/30 {
    border-color: rgba(34, 197, 94, 0.3) !important;
}

[data-theme="light"] .hover\:border-accent:hover,
[data-theme="light"] .hover\:text-accent:hover {
    border-color: #22c55e !important;
    color: #22c55e !important;
}

[data-theme="light"] .hover\:bg-accent\/10:hover {
    background: rgba(34, 197, 94, 0.1) !important;
}

[data-theme="light"] .card {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(20px) saturate(180%);
}

[data-theme="light"] .card:hover {
    border-color: rgba(34, 197, 94, 0.3);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .form-input {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(15, 23, 42, 0.12);
    color: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
}

[data-theme="light"] .form-input::placeholder {
    color: rgba(15, 23, 42, 0.4);
}

[data-theme="light"] .form-input:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
    background: #fff;
}

[data-theme="light"] .btn-outline {
    border-color: rgba(15, 23, 42, 0.15);
    color: rgba(15, 23, 42, 0.95);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
}

[data-theme="light"] .btn-outline:hover {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

[data-theme="light"] .glass {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(20px) saturate(180%);
}

/* ========================================
   Mobile Sidebar Styles
   ======================================== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-modern {
    position: fixed;
    top: 0;
    right: 0;
    width: min(92vw, 380px);
    height: 100vh;
    height: 100dvh;
    background: rgba(10, 18, 26, 0.95);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 210;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.sidebar-modern.open {
    transform: translateX(0);
}

/* Sidebar navigation styling */
.sidebar-modern nav {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar-modern nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-modern nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-modern nav::-webkit-scrollbar-thumb {
    background: rgba(167, 255, 58, 0.3);
    border-radius: 2px;
}

[data-theme="light"] .sidebar-modern nav::-webkit-scrollbar-thumb {
    background: rgba(34, 197, 94, 0.3);
}

/* Light Mode - Sidebar */
[data-theme="light"] .sidebar-overlay {
    background: rgba(15, 23, 42, 0.4);
}

[data-theme="light"] .sidebar-modern {
    background: rgba(255, 255, 255, 0.98);
    border-left-color: rgba(15, 23, 42, 0.08);
    box-shadow: -10px 0 40px rgba(15, 23, 42, 0.1);
}

[data-theme="light"] .sidebar-modern .text-white {
    color: rgba(15, 23, 42, 0.95) !important;
}

[data-theme="light"] .sidebar-modern .text-white\/60 {
    color: rgba(15, 23, 42, 0.6) !important;
}

[data-theme="light"] .sidebar-modern .text-white\/50 {
    color: rgba(15, 23, 42, 0.5) !important;
}

[data-theme="light"] .sidebar-modern .text-white\/40 {
    color: rgba(15, 23, 42, 0.4) !important;
}

[data-theme="light"] .sidebar-modern .border-white\/10 {
    border-color: rgba(15, 23, 42, 0.08) !important;
}

[data-theme="light"] .sidebar-modern .bg-white\/5 {
    background: rgba(15, 23, 42, 0.04) !important;
}

[data-theme="light"] .sidebar-modern button {
    color: rgba(15, 23, 42, 0.9) !important;
}

[data-theme="light"] .sidebar-modern button:hover {
    background: rgba(34, 197, 94, 0.1);
}

/* Sidebar link hover states */
.sidebar-modern a {
    transition: all 0.2s ease;
}

.sidebar-modern a:hover {
    background: rgba(167, 255, 58, 0.1);
}

[data-theme="light"] .sidebar-modern a:hover {
    background: rgba(34, 197, 94, 0.1);
}

/* ========================================
   Responsive Styles
   ======================================== */

/* Extra small devices (phones, less than 640px) */
@media (max-width: 639px) {
    .sidebar-modern {
        width: 100vw;
        max-width: 100vw;
    }
    
    /* Ensure proper touch targets */
    .sidebar-modern a,
    .sidebar-modern button {
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    /* Adjust header spacing for mobile */
    header .mc-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Mobile-friendly form inputs */
    .form-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Adjust hero section for mobile */
    section .grid-cols-1 {
        gap: 2rem;
    }
}

/* Small devices (landscape phones, 640px and up) */
@media (min-width: 640px) and (max-width: 767px) {
    .sidebar-modern {
        width: min(85vw, 380px);
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar-modern {
        width: min(75vw, 380px);
    }
}

/* Large devices (desktops, 1024px and up) */
@media (min-width: 1024px) {
    /* Hide mobile toggle on desktop */
    #mc-mobile-toggle {
        display: none;
    }
    
    /* Ensure sidebar is hidden on desktop */
    .sidebar-modern {
        display: none;
    }
    
    .sidebar-overlay {
        display: none;
    }
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    .sidebar-modern {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    
    .sidebar-modern > div:last-child {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Prevent body scroll when sidebar is open */
body.sidebar-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .sidebar-modern a,
    .sidebar-modern button {
        -webkit-tap-highlight-color: rgba(167, 255, 58, 0.2);
    }
    
    /* Remove hover effects on touch devices */
    .card:hover {
        transform: none;
    }
    
    .btn-primary:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .sidebar-modern {
        border-left-width: 2px;
    }
    
    .sidebar-overlay {
        background: rgba(0, 0, 0, 0.8);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .sidebar-modern {
        transition: none;
    }
    
    .sidebar-overlay {
        transition: none;
    }
    
    .card {
        transition: none;
    }
    
    .btn-primary {
        transition: none;
    }
}

/* ========================================
   Hero Form Field Styling
   ======================================== */

/* Consistent form field styling in hero section */
.hero-form-field {
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.hero-form-field::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.hero-form-field:focus {
    border-color: rgba(167, 255, 58, 0.5);
    box-shadow: 0 0 0 4px rgba(167, 255, 58, 0.1);
    background: rgba(0, 0, 0, 0.5);
}

/* Select dropdown styling - dark background */
.hero-form-field::-ms-expand {
    display: none;
}

select.hero-form-field {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a7ff3a'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
    cursor: pointer;
}

select.hero-form-field option {
    background: #0a121a;
    color: rgba(255, 255, 255, 0.92);
    padding: 0.75rem;
}

select.hero-form-field option:hover,
select.hero-form-field option:focus,
select.hero-form-field option:checked {
    background: rgba(167, 255, 58, 0.2);
    color: #a7ff3a;
}

/* Date input calendar icon - green in dark mode */
input[type="date"].hero-form-field::-webkit-calendar-picker-indicator {
    filter: invert(76%) sepia(49%) saturate(456%) hue-rotate(52deg) brightness(103%) contrast(101%);
    cursor: pointer;
    opacity: 1;
}

input[type="date"].hero-form-field::-webkit-calendar-picker-indicator:hover {
    filter: invert(76%) sepia(49%) saturate(456%) hue-rotate(52deg) brightness(115%) contrast(115%);
}

/* Light mode adjustments for hero form fields */
[data-theme="light"] .hero-form-field {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(15, 23, 42, 0.12);
    color: rgba(15, 23, 42, 0.95);
}

[data-theme="light"] .hero-form-field::placeholder {
    color: rgba(15, 23, 42, 0.4);
}

[data-theme="light"] .hero-form-field:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
    background: #fff;
}

[data-theme="light"] select.hero-form-field {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2322c55e'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 1.25rem !important;
}

[data-theme="light"] select.hero-form-field option {
    background: #ffffff;
    color: rgba(15, 23, 42, 0.95);
}

[data-theme="light"] select.hero-form-field option:hover,
[data-theme="light"] select.hero-form-field option:focus,
[data-theme="light"] select.hero-form-field option:checked {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

[data-theme="light"] input[type="date"].hero-form-field::-webkit-calendar-picker-indicator {
    filter: invert(42%) sepia(87%) saturate(415%) hue-rotate(92deg) brightness(95%) contrast(91%);
}

[data-theme="light"] input[type="date"].hero-form-field::-webkit-calendar-picker-indicator:hover {
    filter: invert(42%) sepia(87%) saturate(415%) hue-rotate(92deg) brightness(110%) contrast(100%);
}

/* ========================================
    Hamburger Menu Animation
    ======================================== */
#mc-mobile-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

#mc-mobile-toggle.open span:nth-child(2) {
    opacity: 0;
}

#mc-mobile-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Light mode: only the mobile burger lines should be darker; keep background unchanged */
[data-theme="light"] #mc-mobile-toggle {
    background: transparent !important;
    border-color: rgba(15,23,42,0.08) !important;
}

[data-theme="light"] #mc-mobile-toggle span {
    background: rgba(15,23,42,0.95) !important;
}

/* ========================================
   Extra Small Breakpoint Utility
   ======================================== */
@media (min-width: 475px) {
    .xs\:inline {
        display: inline !important;
    }
    .xs\:hidden {
        display: none !important;
    }
}

/* ========================================
   Light Mode - Cards & Content
   ======================================== */
[data-theme="light"] .card .text-white\/60 {
    color: rgba(15, 23, 42, 0.6) !important;
}

[data-theme="light"] .card .text-white\/80 {
    color: rgba(15, 23, 42, 0.8) !important;
}

[data-theme="light"] .card .text-white\/90 {
    color: rgba(15, 23, 42, 0.9) !important;
}

[data-theme="light"] .card .text-white {
    color: rgba(15, 23, 42, 0.95) !important;
}

[data-theme="light"] section .text-white\/60 {
    color: rgba(15, 23, 42, 0.6) !important;
}

[data-theme="light"] section .text-white\/80 {
    color: rgba(15, 23, 42, 0.8) !important;
}

[data-theme="light"] section .text-white\/90 {
    color: rgba(15, 23, 42, 0.9) !important;
}

[data-theme="light"] section .text-white {
    color: rgba(15, 23, 42, 0.95) !important;
}

/* ========================================
   Light Mode - Footer
   ======================================== */
[data-theme="light"] footer {
    background: rgba(248, 250, 252, 0.9);
}

[data-theme="light"] footer .text-white\/60 {
    color: rgba(15, 23, 42, 0.6) !important;
}

[data-theme="light"] footer .text-white\/90 {
    color: rgba(15, 23, 42, 0.9) !important;
}

[data-theme="light"] footer .text-white {
    color: rgba(15, 23, 42, 0.95) !important;
}

[data-theme="light"] footer .border-white\/10 {
    border-color: rgba(15, 23, 42, 0.08) !important;
}

[data-theme="light"] footer .bg-white\/5 {
    background: rgba(15, 23, 42, 0.03) !important;
}

/* ========================================
   Light Mode - Section Backgrounds
   ======================================== */
[data-theme="light"] section {
    background: transparent;
}

/* ========================================
   Light Mode - Hero Section Gradients
   ======================================== */
[data-theme="light"] .hero-gradient-overlay {
    background: linear-gradient(to right, rgba(248, 250, 252, 0.95), rgba(248, 250, 252, 0.8), transparent) !important;
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .no-print {
        display: none !important;
    }
    
    .sidebar-modern,
    .sidebar-overlay {
        display: none !important;
    }
}
