/* ============================================
   RESPONSIVE.CSS - Mobile-First Responsive Design
   Meeting Whiteboard Scribe
   ============================================ */

/* ============================================
   BASE MOBILE STYLES (< 768px)
   ============================================ */

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius);
    transition: var(--transition);
}

.mobile-menu-toggle:hover {
    background: var(--surface-secondary);
}

/* Mobile Navigation Menu */
.mobile-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.mobile-nav-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 85%;
    height: 100%;
    background: var(--surface);
    box-shadow: var(--shadow-xl);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding: var(--space-6);
}

.mobile-nav.active .mobile-nav-content {
    transform: translateX(0);
}

.mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.mobile-nav-header h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.mobile-nav-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-1);
}

.mobile-nav-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius);
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: var(--font-size-base);
}

.mobile-nav-item:hover {
    background: var(--surface-secondary);
    color: var(--primary);
}

.mobile-nav-item i {
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.mobile-nav-item:hover i {
    color: var(--primary);
}

.mobile-nav-divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-3) 0;
}

.mobile-nav-item.primary {
    background: var(--primary);
    color: white;
    justify-content: center;
    margin-top: var(--space-4);
}

.mobile-nav-item.primary i {
    color: white;
}

.mobile-nav-item.primary:hover {
    background: var(--primary-dark);
    color: white;
}

/* ============================================
   MOBILE BREAKPOINT (< 768px)
   ============================================ */
@media (max-width: 767px) {
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-nav {
        display: block;
    }

    /* Hide desktop header actions */
    .header-actions > *:not(.mobile-menu-toggle) {
        display: none !important;
    }

    .header-actions {
        gap: var(--space-2);
    }

    /* Header brand text */
    .header-brand h1 {
        font-size: var(--font-size-base);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }

    /* Welcome section */
    .welcome-section {
        padding: var(--space-4);
    }

    .welcome-content h2 {
        font-size: var(--font-size-xl);
        line-height: 1.3;
    }

    .welcome-content > p {
        font-size: var(--font-size-sm);
    }

    /* Upload zone */
    .upload-zone {
        padding: var(--space-6) var(--space-4);
    }

    .upload-icon i {
        font-size: 2.5rem;
    }

    .upload-content h3 {
        font-size: var(--font-size-base);
    }

    .upload-info {
        font-size: var(--font-size-xs);
    }

    .capture-btn {
        margin-top: var(--space-4);
        width: 100%;
    }

    /* Features grid - single column */
    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--space-3);
        padding: var(--space-4) 0;
    }

    .feature-card {
        padding: var(--space-4);
        flex-direction: row;
        text-align: left;
        gap: var(--space-4);
    }

    .feature-icon {
        width: 48px;
        height: 48px;
        flex-shrink: 0;
    }

    .feature-card h4 {
        margin-bottom: var(--space-1);
    }

    /* Demo section */
    .demo-section {
        flex-direction: column;
        gap: var(--space-2);
        margin-top: var(--space-6);
    }

    .demo-btn {
        width: 100%;
    }

    /* Processing section */
    .processing-container {
        padding: var(--space-4);
    }

    .progress-steps {
        flex-wrap: wrap;
        gap: var(--space-2);
        justify-content: center;
    }

    .step {
        width: calc(50% - var(--space-2));
        flex-direction: column;
        padding: var(--space-3);
    }

    .step-label {
        font-size: var(--font-size-xs);
        text-align: center;
    }

    /* Results section - stack vertically */
    .results-container {
        padding: var(--space-4);
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .results-stats {
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .stat-item {
        font-size: var(--font-size-xs);
    }

    .split-view {
        flex-direction: column;
        gap: var(--space-4);
    }

    .original-view,
    .extracted-view {
        width: 100%;
        min-height: auto;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }

    .view-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .content-tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: var(--space-2);
    }

    .content-tabs::-webkit-scrollbar {
        height: 4px;
    }

    /* Export bar */
    .export-bar {
        flex-direction: column;
        gap: var(--space-4);
        padding: var(--space-4);
    }

    .export-options {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-2);
        width: 100%;
    }

    .export-btn {
        flex-direction: column;
        padding: var(--space-3);
        font-size: var(--font-size-xs);
    }

    .export-btn i {
        font-size: var(--font-size-lg);
        margin-bottom: var(--space-1);
    }

    .share-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2);
    }

    .share-actions .btn {
        justify-content: center;
    }

    /* Dashboard */
    .dashboard-container {
        padding: var(--space-4);
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-2);
    }

    /* Modals */
    .modal-overlay {
        padding: var(--space-2);
        align-items: flex-end;
    }

    .modal {
        max-height: 85vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        margin: 0;
        width: 100%;
        max-width: 100%;
    }

    .auth-modal {
        max-width: 100%;
    }

    .modal-header {
        padding: var(--space-4);
    }

    .modal-body {
        padding: var(--space-4);
    }

    .modal-footer {
        padding: var(--space-4);
        flex-direction: column;
        gap: var(--space-2);
    }

    .modal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    /* Payment plans */
    .plans-grid {
        grid-template-columns: 1fr;
    }

    .plan-card.featured {
        transform: none;
    }

    /* Usage options */
    .usage-options {
        grid-template-columns: 1fr;
    }

    /* Toast notifications */
    .toast-container {
        left: var(--space-4);
        right: var(--space-4);
        top: auto;
        bottom: var(--space-4);
    }

    .toast {
        min-width: auto;
        width: 100%;
    }
}

/* ============================================
   TABLET BREAKPOINT (768px - 1024px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Header adjustments */
    .header-brand h1 {
        font-size: var(--font-size-lg);
    }

    .header-actions .btn span {
        display: none;
    }

    .header-actions .btn {
        padding: var(--space-2);
    }

    .header-actions .btn i {
        margin: 0;
    }

    /* Keep New Project button text */
    .header-actions .btn-primary span {
        display: inline;
    }

    /* Welcome section */
    .welcome-content h2 {
        font-size: var(--font-size-2xl);
    }

    /* Features grid - 2 columns */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Results split view */
    .split-view {
        flex-direction: column;
    }

    .original-view,
    .extracted-view {
        width: 100%;
    }

    /* Export options */
    .export-options {
        flex-wrap: wrap;
        justify-content: center;
    }

    .export-btn span {
        display: none;
    }

    .export-btn {
        padding: var(--space-3);
    }

    /* Dashboard stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Plans grid */
    .plans-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .plan-card.featured {
        transform: none;
    }
}

/* ============================================
   LARGE TABLET / SMALL DESKTOP (1024px - 1200px)
   ============================================ */
@media (min-width: 1024px) and (max-width: 1200px) {
    .header-actions .btn:not(.btn-primary) span {
        display: none;
    }

    .header-actions .btn:not(.btn-primary) {
        padding: var(--space-2);
    }

    .features-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .feature-card {
        padding: var(--space-4);
    }

    .feature-card p {
        font-size: var(--font-size-xs);
    }
}

/* ============================================
   DESKTOP (> 1200px)
   ============================================ */
@media (min-width: 1200px) {
    .header-container {
        max-width: 1400px;
    }

    .welcome-container,
    .processing-container,
    .results-container,
    .dashboard-container {
        max-width: 1200px;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .btn-sm {
        min-height: 36px;
        min-width: 36px;
    }

    .tab-btn {
        min-height: 44px;
        padding: var(--space-3) var(--space-4);
    }

    .dropdown-item,
    .mobile-nav-item {
        min-height: 48px;
    }

    /* Remove hover effects that don't work well on touch */
    .btn:hover,
    .feature-card:hover,
    .project-card:hover,
    .whiteboard-card:hover {
        transform: none;
    }

    /* Add active states instead */
    .btn:active {
        transform: scale(0.98);
    }

    .feature-card:active,
    .project-card:active,
    .whiteboard-card:active {
        transform: scale(0.99);
    }
}

/* ============================================
   LANDSCAPE ORIENTATION ON MOBILE
   ============================================ */
@media (max-width: 896px) and (orientation: landscape) {
    .modal-overlay {
        align-items: center;
        padding: var(--space-4);
    }

    .modal {
        max-height: 90vh;
        border-radius: var(--radius-lg);
    }

    .mobile-nav-content {
        width: 320px;
    }

    .upload-zone {
        padding: var(--space-4);
    }

    .progress-steps {
        flex-wrap: nowrap;
    }

    .step {
        width: auto;
    }
}

/* ============================================
   SAFE AREA INSETS (for notched devices)
   ============================================ */
@supports (padding: max(0px)) {
    .header {
        padding-left: max(var(--space-4), env(safe-area-inset-left));
        padding-right: max(var(--space-4), env(safe-area-inset-right));
    }

    .main-content {
        padding-left: max(var(--space-4), env(safe-area-inset-left));
        padding-right: max(var(--space-4), env(safe-area-inset-right));
        padding-bottom: max(var(--space-6), env(safe-area-inset-bottom));
    }

    .mobile-nav-content {
        padding-right: max(var(--space-6), env(safe-area-inset-right));
    }

    .toast-container {
        bottom: max(var(--space-4), env(safe-area-inset-bottom));
    }
}

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

    .mobile-nav,
    .mobile-nav-content {
        transition: none;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .header,
    .mobile-nav,
    .toast-container,
    .modal-overlay,
    .upload-zone,
    .export-bar,
    .btn {
        display: none !important;
    }

    .main-content {
        padding: 0;
    }

    .results-container {
        box-shadow: none;
    }

    .split-view {
        flex-direction: column;
    }

    .original-view,
    .extracted-view {
        width: 100%;
        page-break-inside: avoid;
    }
}
