/* St Albans Surveyors - Custom CSS */

/* Import Tailwind base styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Playfair+Display:wght@400;500;600;700&display=swap');

/* Custom CSS Variables */
:root {
    --primary-blue: #2563eb;
    --primary-blue-hover: #1d4ed8;
    --secondary-green: #059669;
    --accent-purple: #7c3aed;
    --accent-orange: #ea580c;
    --gray-50: #f8fafc;
    --gray-900: #0f172a;
    --gradient-primary: linear-gradient(135deg, var(--primary-blue) 0%, #1e40af 100%);
    --gradient-secondary: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-large: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: #334155;
    overflow-x: hidden;
}

.font-playfair {
    font-family: 'Playfair Display', serif;
}

.font-inter {
    font-family: 'Inter', sans-serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-blue);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-blue-hover);
}

/* Navigation Styles */
#navbar {
    transition: all 0.3s ease;
}

#navbar.scrolled {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-soft);
}

/* Mobile Menu Animation */
#mobile-menu {
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.3s ease;
    max-height: 0;
    overflow: hidden;
}

#mobile-menu.show {
    transform: translateY(0);
    opacity: 1;
    display: block !important;
    max-height: 500px;
}

/* Mobile Menu Button Styling */
#mobile-menu-btn {
    z-index: 60;
    position: relative;
}

#mobile-menu-btn:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Ensure mobile menu appears above other content */
.lg\:hidden {
    z-index: 50;
}

/* Hero Section Enhancements */
.hero-background {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #dbeafe 100%);
    position: relative;
}

/* Hero Section Container Fix */
#home {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

#home .container {
    max-width: 100%;
    width: 100%;
}

.hero-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><g fill="%23dbeafe" fill-opacity="0.4" fill-rule="nonzero"><circle cx="30" cy="30" r="1.5"/></g></svg>');
    opacity: 0.3;
}

/* Video Background Styling */
#hero-video {
    object-fit: cover;
    width: 100%;
    height: 100%;
    transition: opacity 0.3s ease;
}

#video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#video-fallback {
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

/* Video Modal Styling */
#video-modal {
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

#video-modal video {
    max-height: 80vh;
    width: 100%;
    height: auto;
}

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

/* Ensure video controls are visible */
video::-webkit-media-controls-panel {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Mobile video optimization */
@media (max-width: 768px) {
    #hero-video {
        object-position: center;
    }
    
    #video-modal .relative {
        margin: 1rem;
    }
    
    /* Fix hero form on mobile */
    #home .grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1rem 0;
    }
    
    #home .grid > div {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Ensure form container fits viewport */
    #home {
        overflow-x: hidden;
    }
}

/* Button Animations */
.btn-primary {
    background: var(--gradient-primary);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

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

/* Service Cards */
.service-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.9) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.service-card:hover::before {
    transform: scaleX(1);
}

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

/* Icon Animations */
.service-icon {
    transition: all 0.3s ease;
}

.service-card:hover .service-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Testimonial Cards */
.testimonial-card {
    transition: all 0.3s ease;
    position: relative;
}

.testimonial-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-blue), var(--secondary-green), var(--accent-purple));
    border-radius: 1rem;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.testimonial-card:hover::before {
    opacity: 1;
}

.testimonial-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

/* Stats Animation */
.stat-counter {
    font-variant-numeric: tabular-nums;
}

/* Form Styling */
.hubspot-form {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Hero Form Container */
#quote-form {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* HubSpot Form Responsive Fixes */
#quote-form .hbspt-form {
    max-width: 100%;
    width: 100%;
}

#quote-form .hs-form {
    max-width: 100% !important;
    width: 100% !important;
}

#quote-form .hs-form fieldset {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

#quote-form .hs-form .hs-input {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

#quote-form .hs-form .hs-form-field {
    max-width: 100% !important;
    width: 100% !important;
}

#quote-form .hs-form .hs-button {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Additional form containment */
#quote-form * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Specific mobile form fixes */
@media (max-width: 480px) {
    #home .grid > div:last-child {
        max-width: calc(100vw - 2rem);
        margin: 0 auto;
    }
    
    #quote-form {
        padding: 0;
        margin: 0;
    }
}

/* Hero Section Layout Fix */
.hero-section {
    padding-top: 5rem;
    padding-bottom: 5rem;
}

@media (min-width: 1024px) {
    .hero-section {
        padding-top: 8rem;
        padding-bottom: 8rem;
    }
}

/* Floating Elements */
.floating {
    animation: float 3s ease-in-out infinite;
}

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

/* Pulse Animation */
.pulse-slow {
    animation: pulse 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Gradient Text */
.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Custom Animations */
.slide-in-left {
    transform: translateX(-50px);
    opacity: 0;
    transition: all 0.6s ease;
}

.slide-in-left.animate {
    transform: translateX(0);
    opacity: 1;
}

.slide-in-right {
    transform: translateX(50px);
    opacity: 0;
    transition: all 0.6s ease;
}

.slide-in-right.animate {
    transform: translateX(0);
    opacity: 1;
}

.fade-in-up {
    transform: translateY(30px);
    opacity: 0;
    transition: all 0.6s ease;
}

.fade-in-up.animate {
    transform: translateY(0);
    opacity: 1;
}

/* Loading Animation */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Video Player Styles */
.video-player {
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.video-player:hover {
    transform: scale(1.02);
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.play-button:hover {
    background: rgba(255, 255, 255, 1);
    transform: translate(-50%, -50%) scale(1.1);
}

.play-button i {
    font-size: 24px;
    color: var(--primary-blue);
    margin-left: 4px;
}

/* Responsive Design Enhancements */
@media (max-width: 768px) {
    .hero-content {
        text-align: center;
    }
    
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.1;
    }
    
    .service-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .testimonial-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 2.5rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .container {
        max-width: 100% !important;
        padding: 0 !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .btn-primary {
        background: #000;
        color: #fff;
        border: 2px solid #fff;
    }
    
    .service-card {
        border: 2px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles for Accessibility */
*:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

button:focus,
a:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-blue);
    color: white;
    padding: 8px;
    text-decoration: none;
    transition: top 0.3s;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f172a;
        --text-primary: #f1f5f9;
        --border-color: #334155;
    }
}

/* Custom Utility Classes */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.backdrop-blur-strong {
    backdrop-filter: blur(20px);
}

.border-gradient {
    border: 1px solid transparent;
    background: linear-gradient(white, white) padding-box, 
                var(--gradient-primary) border-box;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Custom Scrollbar for Content Areas */
.content-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-blue) #f1f5f9;
}

.content-scroll::-webkit-scrollbar {
    width: 6px;
}

.content-scroll::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.content-scroll::-webkit-scrollbar-thumb {
    background: var(--primary-blue);
    border-radius: 3px;
}

/* Performance Optimizations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* Custom Grid System */
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.grid-auto-fill {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Image Optimization */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.img-responsive {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Loading States */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.skeleton-text {
    height: 1em;
    margin: 0.5em 0;
    border-radius: 4px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Interactive Elements */
.interactive:hover {
    cursor: pointer;
}

.clickable {
    cursor: pointer;
    user-select: none;
}

/* Typography Enhancements */
.text-balance {
    text-wrap: balance;
}

.text-pretty {
    text-wrap: pretty;
}

/* Layout Helpers */
.full-bleed {
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}

.container-narrow {
    max-width: 65ch;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Animation Delays */
.delay-100 {
    animation-delay: 100ms;
}

.delay-200 {
    animation-delay: 200ms;
}

.delay-300 {
    animation-delay: 300ms;
}

.delay-400 {
    animation-delay: 400ms;
}

.delay-500 {
    animation-delay: 500ms;
}

/* Component Specific Styles */
.hero-pattern {
    background-image: radial-gradient(circle at 1px 1px, rgba(59, 130, 246, 0.15) 1px, transparent 0);
    background-size: 20px 20px;
}

.section-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #e2e8f0, transparent);
    margin: 4rem 0;
}

.floating-card {
    transform: translateY(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.floating-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Form Enhancements */
.form-field {
    position: relative;
}

.form-field input:focus + label,
.form-field textarea:focus + label {
    transform: translateY(-1.5rem) scale(0.875);
    color: var(--primary-blue);
}

/* Status Indicators */
.status-online {
    position: relative;
}

.status-online::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-large);
    padding: 1rem;
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification.show {
    transform: translateX(0);
}

/* Progress Indicators */
.progress-bar {
    width: 100%;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Tooltip Styles */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 120px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 0;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Theme Toggle */
.theme-toggle {
    background: var(--gradient-primary);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* Cookie Consent */
.cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 1rem;
    text-align: center;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.cookie-consent.show {
    transform: translateY(0);
}

/* Performance Optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Smooth Scrolling Enhancements */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Final Responsive Adjustments */
@media (min-width: 1920px) {
    .container {
        max-width: 1400px;
    }
}

@media (max-width: 320px) {
    .hero-title {
        font-size: 1.75rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}