/*
 * Dental Voice Pro - Mobile-First Responsive Overrides
 * Ensures seamless responsiveness from mobile (320px) to desktop (2560px+)
 */

/* ============================================
   MOBILE FIRST BASE (320px+)
   ============================================ */

/* Prevent horizontal scroll on all devices */
html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

/* Ensure all containers don't overflow */
* {
    max-width: 100%;
}

img, svg, video, iframe {
    max-width: 100%;
    height: auto;
}

/* ============================================
   NAVIGATION - MOBILE OPTIMIZED
   ============================================ */

/* Mobile-only navigation fixes */
@media (max-width: 1024px) {
    /* Container - full width with edge padding */
    .nav .container {
        padding-left: 1rem;
        padding-right: 1rem;
        max-width: 100%;
    }

    /* Ensure nav content has proper flex layout */
    .nav-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
        gap: 0;
        padding: 0.5rem 0;
        width: 100%;
    }

    /* Logo firmly anchored left */
    .nav-logo {
        order: 1;
        z-index: 1001;
        flex-shrink: 0;
        margin: 0;
        padding: 0;
    }

    /* Logo icon - larger for better mobile visibility */
    .logo-icon {
        height: 48px;
        width: 48px;
    }

    .nav-logo-text {
        font-size: 1.1rem;
        font-weight: 600;
    }

    /* Hide theme toggle on mobile - move to slide-out menu */
    .nav-content > .theme-toggle {
        display: none !important;
    }

    /* Mobile menu button firmly anchored right */
    .mobile-menu-button {
        display: flex;
        order: 4;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 5px;
        width: 36px;
        height: 36px;
        z-index: 1002;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 6px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        flex-shrink: 0;
        margin: 0;
        border-radius: 6px;
        position: relative;
    }

    .nav-content .theme-toggle {
        order: 2;
        margin-left: auto;  /* Push toggle+hamburger to the right */
        margin-right: 0.5rem;
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .nav-content .theme-toggle svg {
        width: 20px;
        height: 20px;
    }

    /* Transform hamburger into subtle elegant X when active */
    .mobile-menu-button.active {
        background: linear-gradient(135deg, #fca5a5 0%, #f87171 50%, #ef4444 100%);
        box-shadow:
            0 1px 3px rgba(239, 68, 68, 0.12),
            0 2px 4px rgba(220, 38, 38, 0.08),
            inset 0 0.5px 0 rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(239, 68, 68, 0.2);
        transform: rotate(0deg);
    }

    .mobile-menu-button.active:hover {
        transform: scale(1.03) rotate(45deg);
        box-shadow:
            0 2px 4px rgba(239, 68, 68, 0.15),
            0 3px 6px rgba(220, 38, 38, 0.1),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
        background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #f97316 100%);
    }

    .mobile-menu-button.active:active {
        transform: scale(0.97);
        box-shadow:
            0 1px 2px rgba(239, 68, 68, 0.1),
            inset 0 1px 2px rgba(0, 0, 0, 0.1);
    }
}

.mobile-menu-button span {
    display: block;
    width: 20px;
    height: 1.5px;
    background-color: var(--text-primary, #0A0A0A);
    border-radius: 1px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Transform spans into elegant white X when menu is active */
.mobile-menu-button.active span {
    background-color: #ffffff;
    box-shadow: 0 0.5px 1px rgba(0, 0, 0, 0.08);
}

.mobile-menu-button.active span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.mobile-menu-button.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-menu-button.active span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Mobile menu overlay - Enhanced */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.6), rgba(30, 41, 59, 0.7));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile nav links - positioned off-screen by default, slides in when active */
@media (max-width: 1024px) {
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 320px;
        height: 100vh;
        background: var(--bg-secondary);
        flex-direction: column;
        align-items: flex-start;
        padding: 1.5rem 2rem 2rem;
        gap: 0;
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        overflow-y: auto;
        order: 3;
        border-left: 1px solid var(--border-light);
        transform: translateX(0);
        visibility: hidden;
        pointer-events: none;
    }

    .nav-links.active {
        right: 0;
        visibility: visible;
        pointer-events: auto;
    }

    .nav-links a {
        width: 100%;
        padding: 1.125rem 1rem;
        border-bottom: 1px solid rgba(15, 23, 42, 0.06);
        font-size: 1.0625rem;
        font-weight: 500;
        color: #1e293b;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 8px;
        margin-bottom: 0.25rem;
        position: relative;
        overflow: hidden;
    }

    .nav-links a::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        width: 4px;
        height: 100%;
        background: linear-gradient(135deg, #6366f1, #8b5cf6);
        transform: scaleY(0);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-links a:hover {
        padding-left: 1.5rem;
        background: linear-gradient(90deg, rgba(99, 102, 241, 0.05), transparent);
        color: #6366f1;
        border-bottom-color: transparent;
    }

    .nav-links a:hover::before {
        transform: scaleY(1);
    }

    /* Live Demo button - Stunning emerald/teal gradient */
    .nav-links .nav-live-demo {
        margin-top: 2rem;
        width: 100%;
        text-align: center;
        border: none !important;
        border-radius: 12px;
        background: linear-gradient(135deg, #10b981 0%, #14b8a6 50%, #06b6d4 100%);
        color: white !important;
        padding: 1.125rem 1.5rem;
        font-weight: 700;
        font-size: 1.0625rem;
        box-shadow:
            0 4px 16px rgba(16, 185, 129, 0.3),
            0 2px 8px rgba(20, 184, 166, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.2),
            inset 0 -1px 0 rgba(0, 0, 0, 0.1);
        transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        border: 1px solid rgba(6, 182, 212, 0.3);
        letter-spacing: 0.025em;
        text-transform: uppercase;
        font-size: 0.9375rem;
    }

    .nav-links .nav-live-demo:hover {
        transform: translateY(-3px) scale(1.02);
        padding-left: 1.5rem !important;
        box-shadow:
            0 8px 24px rgba(16, 185, 129, 0.4),
            0 4px 12px rgba(20, 184, 166, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.3),
            inset 0 -2px 0 rgba(0, 0, 0, 0.15);
        background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 50%, #0ea5e9 100%);
    }

    .nav-links .nav-live-demo:hover::before {
        transform: scaleY(0) !important;
    }

    .nav-links .nav-live-demo:active {
        transform: translateY(0) scale(0.98);
        box-shadow:
            0 2px 8px rgba(16, 185, 129, 0.2),
            inset 0 2px 6px rgba(0, 0, 0, 0.15);
    }

    /* Sign In button - Stunning purple gradient */
    .nav-links .btn-nav-cta {
        margin-top: 1rem;
        width: 100%;
        text-align: center;
        border: none !important;
        border-radius: 12px;
        background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
        color: white !important;
        padding: 1.125rem 1.5rem;
        font-weight: 700;
        font-size: 1.0625rem;
        box-shadow:
            0 4px 16px rgba(99, 102, 241, 0.3),
            0 2px 8px rgba(139, 92, 246, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.2),
            inset 0 -1px 0 rgba(0, 0, 0, 0.1);
        transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        border: 1px solid rgba(168, 85, 247, 0.3);
        letter-spacing: 0.025em;
        text-transform: uppercase;
        font-size: 0.9375rem;
    }

    .nav-links .btn-nav-cta:hover {
        transform: translateY(-3px) scale(1.02);
        padding-left: 1.5rem !important;
        box-shadow:
            0 8px 24px rgba(99, 102, 241, 0.4),
            0 4px 12px rgba(139, 92, 246, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.3),
            inset 0 -2px 0 rgba(0, 0, 0, 0.15);
        background: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #c026d3 100%);
    }

    .nav-links .btn-nav-cta:hover::before {
        transform: scaleY(0) !important;
    }

    .nav-links .btn-nav-cta:active {
        transform: translateY(0) scale(0.98);
        box-shadow:
            0 2px 8px rgba(99, 102, 241, 0.2),
            inset 0 2px 6px rgba(0, 0, 0, 0.15);
    }
}

/* ============================================
   HERO SECTION - MOBILE
   ============================================ */

.hero {
    padding-top: 90px;
    padding-bottom: 3rem;
}

.hero-title {
    font-size: 2rem;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.hero-cta {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.hero-cta .btn {
    width: 100%;
    min-height: 50px;
    font-size: 1rem;
}

/* Dashboard preview - mobile */
.dashboard-preview {
    margin-top: 2rem;
    width: 100%;
    max-width: 100%;
}

.preview-content {
    padding: 1rem !important;
}

.preview-content > div[style*="grid"] {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
}

/* ============================================
   AUTOMATION GALLERY - MOBILE
   ============================================ */

.automation-card {
    padding: 1rem;
    margin-bottom: 1rem;
}

.automation-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
}

/* ============================================
   AUTOMATION SECTION - MOBILE
   ============================================ */

.automation-title {
    font-size: 2rem !important;
}

.automation-subtitle {
    font-size: 1rem !important;
}

.comparison-intro {
    font-size: 1rem !important;
}

.comparison-content {
    font-size: 1rem !important;
}

.capabilities-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
}

.capability-card {
    padding: 1.5rem !important;
}

.capability-header {
    flex-direction: column;
    align-items: flex-start !important;
}

.capability-title {
    font-size: 1.25rem !important;
}

.capability-divider {
    flex-direction: column !important;
}

.capability-footer {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 0.75rem;
}

.summary-comparison {
    grid-template-columns: 1fr !important;
}

.automation-summary {
    padding: 1.5rem !important;
}

.summary-title {
    font-size: 1.5rem !important;
}

.cta-title {
    font-size: 1.75rem !important;
}

.cta-description {
    font-size: 1.1rem !important;
}

.cta-note {
    font-size: 0.9rem !important;
}

/* Modal responsive */
.modal-content {
    width: 95% !important;
    max-height: 85vh !important;
}

.modal-header {
    padding: 1.5rem !important;
}

.modal-title {
    font-size: 1.25rem !important;
}

.modal-body {
    padding: 1.5rem !important;
}

.modal-footer {
    flex-direction: column;
    padding: 1rem 1.5rem !important;
}

.btn-modal {
    width: 100%;
}

/* ============================================
   PRICING CARDS - MOBILE
   Note: Grid columns handled by media queries below
   ============================================ */

.pricing-grid {
    gap: 1.5rem;
}

.pricing-card {
    padding: 1.5rem;
    min-height: auto;
}

.pricing-card .pricing-header {
    text-align: center;
}

.pricing-card .pricing-features {
    margin: 1rem 0;
}

.pricing-card .pricing-features li {
    font-size: 0.875rem;
    padding: 0.5rem 0;
}

.pricing-card .btn {
    width: 100%;
    justify-content: center;
}

/* ============================================
   FORMS - MOBILE OPTIMIZED
   ============================================ */

input, textarea, select {
    font-size: 16px !important; /* Prevents zoom on iOS */
    min-height: 44px;
}

button, .btn {
    min-height: 44px;
    touch-action: manipulation;
}

/* ============================================
   FOOTER - MOBILE
   ============================================ */

@media (max-width: 1024px) {
    .footer {
        padding: 2rem 0 1rem;
    }

    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 2rem;
        text-align: center;
    }

    .footer-section {
        text-align: center;
    }

    .footer-section ul {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }

    .footer-bottom {
        text-align: center;
        padding: 1rem 0 0;
        margin-top: 2rem;
    }
}

/* ============================================
   TABLET (481px - 768px)
   ============================================ */

@media (min-width: 481px) {
    .logo-icon {
        height: 52px;
        width: 52px;
    }

    .nav-logo-text {
        font-size: 1.2rem;
        font-weight: 600;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .preview-content > div[style*="grid"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Automation section - larger mobile */
    .automation-title {
        font-size: 2.5rem !important;
    }

    .automation-subtitle {
        font-size: 1.125rem !important;
    }

    .comparison-intro,
    .comparison-content {
        font-size: 1.125rem !important;
    }

    .capability-divider {
        flex-direction: row !important;
    }

    .automation-summary {
        padding: 2rem !important;
    }

    .summary-title {
        font-size: 1.75rem !important;
    }
}

/* ============================================
   DESKTOP (1025px+)
   ============================================ */

@media (min-width: 1025px) {
    /* Consistent nav padding - scales up from mobile */
    .nav .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .logo-icon {
        height: 50px;
        width: 50px;
    }

    .nav-logo-text {
        font-size: 1.3rem;
        font-weight: 600;
    }

    .hero {
        padding-top: 120px;
        padding-bottom: 4rem;
    }

    .hero-title {
        font-size: 3rem;
    }

    .hero-subtitle {
        font-size: 1.25rem;
    }

    .hero-cta {
        flex-direction: row;
        width: auto;
    }

    .hero-cta .btn {
        width: auto;
        padding-left: 2rem;
        padding-right: 2rem;
    }

    /* Automation section - tablet landscape */
    .automation-title {
        font-size: 3rem !important;
    }

    .automation-subtitle {
        font-size: 1.25rem !important;
    }

    .capabilities-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .capability-header {
        flex-direction: row !important;
        align-items: center !important;
    }

    .capability-title {
        font-size: 1.5rem !important;
    }

    .capability-footer {
        flex-direction: row !important;
        align-items: center !important;
    }

    .summary-comparison {
        grid-template-columns: 1fr 1fr !important;
    }

    .automation-summary {
        padding: 2.5rem !important;
    }

    .summary-title {
        font-size: 2rem !important;
    }

    .cta-title {
        font-size: 2.5rem !important;
    }

    .cta-description {
        font-size: 1.3rem !important;
    }

    .cta-note {
        font-size: 1rem !important;
    }

    /* Modal responsive */
    .modal-content {
        width: 90% !important;
        max-width: 800px !important;
    }

    .modal-footer {
        flex-direction: row;
        justify-content: flex-end;
    }

    .btn-modal {
        width: auto;
    }

    .automation-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .pricing-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Full desktop navigation (1025px+) */
@media (min-width: 1025px) {
    .nav-links {
        display: flex;
        flex-direction: row;
        position: static;
        width: auto;
        height: auto;
        background: transparent;
        padding: 0;
        gap: clamp(0.5rem, 1.2vw, var(--spacing-md));
        box-shadow: none;
        align-items: center;
        flex-wrap: nowrap !important;
        white-space: nowrap;
    }

    .mobile-menu-button {
        display: none;
    }
}

/* ============================================
   DESKTOP (1025px - 1440px)
   ============================================ */

@media (min-width: 1025px) {
    .logo-icon {
        height: 55px;
        width: 55px;
    }

    .nav-logo-text {
        font-size: 1.45rem;
        font-weight: 600;
    }

    .hero-title {
        font-size: 3.5rem;
    }

    .hero-subtitle {
        font-size: 1.375rem;
    }

    /* Automation section - desktop */
    .automation-title {
        font-size: 3.5rem !important;
    }

    .automation-subtitle {
        font-size: 1.5rem !important;
    }

    .capabilities-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .automation-summary {
        padding: 3rem !important;
    }

    .automation-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .pricing-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    .container {
        padding: 0 3rem;
    }
}

/* ============================================
   LARGE DESKTOP (1441px - 1920px)
   ============================================ */

@media (min-width: 1441px) {
    /* Larger padding on large screens */
    .nav .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }

    .logo-icon {
        height: 60px;
        width: 60px;
    }

    .nav-logo-text {
        font-size: 1.55rem;
        font-weight: 600;
    }

    .hero-title {
        font-size: 4rem;
    }

    .container {
        max-width: 1400px;
    }
}

/* ============================================
   ULTRA-WIDE (1921px+)
   ============================================ */

@media (min-width: 1921px) {
    /* Maximum padding on ultra-wide */
    .nav .container {
        padding-left: 3rem;
        padding-right: 3rem;
    }

    .logo-icon {
        height: 65px;
        width: 65px;
    }

    .nav-logo-text {
        font-size: 1.65rem;
        font-weight: 600;
    }

    .hero-title {
        font-size: 4.5rem;
    }

    .container {
        max-width: 1600px;
    }
}

/* ============================================
   ACCESSIBILITY & TOUCH OPTIMIZATION
   ============================================ */

/* Ensure tap targets are at least 44x44px for mobile */
@media (max-width: 1024px) {
    a:not(.logo-icon), button, input, select, textarea,
    .btn, .automation-card, .pricing-card {
        min-height: 44px;
        touch-action: manipulation;
    }

    /* Prevent double-tap zoom on buttons */
    button, .btn {
        touch-action: manipulation;
        user-select: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    /* Ensure readable font sizes on mobile (prevent zoom) */
    body, p, li, span, div {
        font-size: max(14px, 1em);
    }

    /* Larger touch targets for interactive elements */
    .automation-card .btn-expand,
    .automation-card .btn-configure {
        min-height: 44px;
        padding: 0.625rem 1rem;
    }
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Prevent text size adjustment on orientation change */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Safe areas for notched devices */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }

    .nav {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .nav, .mobile-menu-button, .hero-cta {
        display: none;
    }

    body {
        font-size: 12pt;
    }
}
