/* ============================================
   NeuraPM - Shared Responsive Styles
   Comprehensive Mobile-First Breakpoints
   ============================================ */

/* ============================================
   BASE RESPONSIVE UTILITIES
   ============================================ */

/* Ensure proper viewport behavior */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
}

/* Responsive tables */
table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

/* Touch-friendly tap targets */
@media (max-width: 768px) {
    button, 
    .btn, 
    a.btn,
    input[type="button"],
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ============================================
   LARGE DESKTOP (1400px+)
   ============================================ */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
}

/* ============================================
   DESKTOP (1200px - 1399px)
   ============================================ */
@media (max-width: 1399px) {
    .subphase-container,
    .main-container,
    .page-container {
        padding: 1.25rem 3rem;
    }
}

/* ============================================
   SMALL DESKTOP / LARGE TABLET (992px - 1199px)
   ============================================ */
@media (max-width: 1199px) {
    .subphase-container,
    .main-container,
    .page-container {
        padding: 1rem 2rem;
    }

    /* Navigation adjustments */
    .top-nav-bar {
        gap: 1rem;
        padding: 0.5rem 0.75rem;
    }

    .page-title {
        font-size: 20px;
    }

    /* Grid adjustments */
    .sprint-view {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* Gantt adjustments */
    .gantt-timeline-header {
        grid-template-columns: 120px repeat(5, 1fr);
    }

    .gantt-lane {
        grid-template-columns: 120px 1fr;
    }

    .gantt-timeline-header-spacer,
    .gantt-lane-label {
        width: 120px;
        min-width: 120px;
    }

    /* Table adjustments */
    .project-table-row {
        grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr 1.2fr 0.8fr;
        gap: 12px;
        padding: 12px;
    }

    /* Tracker/Panel items */
    .tracker-item,
    .panel-item {
        padding: 0.75rem;
    }

    /* Filter bar */
    .filter-mode-bar {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    /* Cards */
    .glass-card,
    .artifact-card,
    .scope-card {
        padding: 1rem;
    }

    /* Floating actions */
    .floating-actions {
        right: 1rem;
    }

    .float-btn {
        width: 48px;
        height: 48px;
    }
}

/* ============================================
   TABLET (768px - 991px)
   ============================================ */
@media (max-width: 991px) {
    .subphase-container,
    .main-container,
    .page-container {
        padding: 1rem 1.5rem;
    }

    /* Navigation */
    .top-nav-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem;
    }

    .nav-back-btn span,
    .phases-popup-btn span {
        display: none;
    }

    .nav-back-btn,
    .phases-popup-btn {
        padding: 10px;
    }

    .title-section {
        order: -1;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .page-title {
        font-size: 18px;
    }

    .page-subtitle {
        font-size: 12px;
    }

    /* Sprint view - 2 columns */
    .sprint-view {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    /* Gantt view - scrollable */
    .gantt-view {
        overflow-x: auto;
    }

    .gantt-timeline-header,
    .gantt-swim-lanes {
        min-width: 800px;
    }

    /* Side panels */
    .side-panel {
        width: 320px;
    }

    /* Tables */
    .project-table-row {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
    }

    .project-table-row .col-client,
    .project-table-row .col-date {
        display: none;
    }

    /* Filter bar */
    .filter-mode-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .mode-toggle-wrapper {
        margin-left: 0;
        justify-content: center;
    }

    .mode-toggle {
        width: 100%;
        justify-content: center;
    }

    /* Dropdown */
    .dropdown-trigger {
        width: 100%;
        justify-content: center;
    }

    /* Cards grid */
    .phases-cards-grid,
    .artifacts-grid,
    .scope-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    /* Footer bar */
    .floating-footer-bar {
        width: 90%;
    }

    .footer-label {
        font-size: 10px;
    }

    /* Workshop/Notes grids */
    .workshop-grid,
    .notes-grid,
    .schedule-grid {
        grid-template-columns: 1fr;
    }

    /* Tracker grids */
    .tracker-grid,
    .rtm-grid {
        grid-template-columns: 1fr;
    }

    /* Entry/Exit criteria */
    .criteria-container {
        flex-direction: column;
    }

    .entry-criteria,
    .exit-criteria {
        width: 100%;
    }
}

/* ============================================
   MOBILE LANDSCAPE / SMALL TABLET (576px - 767px)
   ============================================ */
@media (max-width: 767px) {
    .subphase-container,
    .main-container,
    .page-container {
        padding: 0.75rem 1rem;
        padding-bottom: 6rem;
    }

    /* Navigation */
    .top-nav-bar {
        padding: 0.5rem;
        border-radius: 14px;
        margin-bottom: 0.75rem;
    }

    .page-title {
        font-size: 16px;
    }

    /* Sprint view - single column */
    .sprint-view {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .swim-lane {
        min-height: 300px;
    }

    /* Side panels - full width */
    .side-panel {
        width: 100%;
        right: -100%;
    }

    .side-panel.open {
        right: 0;
    }

    /* Floating actions - bottom row */
    .floating-actions {
        position: fixed;
        bottom: 5rem;
        right: 50%;
        transform: translateX(50%);
        top: auto;
        flex-direction: row;
        gap: 0.5rem;
    }

    .float-btn {
        width: 44px;
        height: 44px;
    }

    /* Footer bar */
    .floating-footer-bar {
        width: 95%;
        max-width: none;
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .footer-action-item {
        padding: 0.4rem 0.5rem;
        flex-direction: column;
        gap: 4px;
    }

    .footer-icon {
        width: 28px;
        height: 28px;
    }

    .footer-label {
        font-size: 9px;
    }

    /* Week tabs - horizontal scroll */
    .week-tabs-container {
        flex-direction: column;
        gap: 0.5rem;
    }

    .week-tabs,
    .role-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.5rem;
    }

    .week-tabs::-webkit-scrollbar,
    .role-tabs::-webkit-scrollbar {
        display: none;
    }

    .week-tab,
    .role-tab {
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* Cards grid */
    .phases-cards-grid,
    .artifacts-grid,
    .scope-grid {
        grid-template-columns: 1fr;
    }

    /* Modal adjustments */
    .project-phases-modal,
    .filters-modal {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-title {
        font-size: 18px;
    }

    /* Tables - card view */
    .projects-table-container {
        overflow-x: auto;
    }

    .project-table-row {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 1rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        margin-bottom: 0.5rem;
    }

    .project-table-row.header {
        display: none;
    }

    /* Form elements */
    .filter-search-input,
    .search-input,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Popups */
    .filters-overlay,
    .project-phases-overlay {
        padding: 1rem;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   MOBILE PORTRAIT (< 576px)
   ============================================ */
@media (max-width: 575px) {
    .subphase-container,
    .main-container,
    .page-container {
        padding: 0.5rem;
        padding-bottom: 5rem;
    }

    /* Typography */
    .page-title {
        font-size: 14px;
    }

    .page-subtitle {
        font-size: 11px;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }
    h4 { font-size: 1rem; }

    /* Navigation */
    .top-nav-bar {
        padding: 0.4rem;
        gap: 0.5rem;
    }

    .nav-back-btn,
    .phases-popup-btn {
        padding: 8px;
    }

    /* Buttons */
    .mode-btn {
        padding: 10px 16px;
        font-size: 12px;
    }

    .dropdown-trigger,
    .more-filters-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Task cards */
    .task-card {
        padding: 10px;
    }

    .task-title {
        font-size: 13px;
    }

    /* Floating footer */
    .floating-footer-bar {
        bottom: 0.5rem;
        border-radius: 20px;
    }

    .footer-action-item {
        padding: 0.3rem 0.4rem;
    }

    .footer-icon {
        width: 24px;
        height: 24px;
    }

    .footer-icon svg {
        width: 18px;
        height: 18px;
    }

    .footer-label {
        font-size: 8px;
    }

    /* Cards */
    .glass-card,
    .artifact-card,
    .scope-card,
    .phase-main-card {
        padding: 0.75rem;
    }

    .feature-icon {
        width: 36px;
        height: 36px;
    }

    .feature-icon svg {
        width: 18px;
        height: 18px;
    }

    /* Tracker items */
    .tracker-item {
        padding: 0.75rem;
        font-size: 13px;
    }

    /* Side panel */
    .panel-header h3 {
        font-size: 16px;
    }

    /* Gantt bars */
    .gantt-bar {
        height: 36px;
        font-size: 10px;
        padding: 0 8px;
    }

    /* Week/Role tabs */
    .week-tab,
    .role-tab {
        padding: 6px 12px;
        font-size: 11px;
    }

    .week-tab svg {
        width: 14px;
        height: 14px;
    }

    /* Floating actions */
    .floating-actions {
        bottom: 4.5rem;
        gap: 0.4rem;
    }

    .float-btn {
        width: 40px;
        height: 40px;
    }

    .float-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* ============================================
   VERY SMALL DEVICES (< 360px)
   ============================================ */
@media (max-width: 359px) {
    .subphase-container,
    .main-container,
    .page-container {
        padding: 0.25rem;
        padding-bottom: 4.5rem;
    }

    .page-title {
        font-size: 12px;
    }

    .mode-btn {
        padding: 8px 12px;
        font-size: 11px;
    }

    .floating-footer-bar {
        padding: 0.25rem;
    }

    .footer-action-item {
        padding: 0.25rem 0.3rem;
    }

    .footer-label {
        display: none;
    }
}

/* ============================================
   LANDSCAPE ORIENTATION FIXES
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .floating-actions {
        top: 50%;
        transform: translateY(-50%);
        right: 0.5rem;
        bottom: auto;
        flex-direction: column;
    }

    .floating-footer-bar {
        bottom: 0.25rem;
    }

    .side-panel {
        max-height: 100vh;
    }

    .project-phases-modal {
        max-height: 95vh;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .floating-actions,
    .floating-footer-bar,
    .side-panel,
    .nav-back-btn,
    .phases-popup-btn,
    .add-filter-btn {
        display: none !important;
    }

    .subphase-container,
    .main-container {
        padding: 0;
    }

    .sprint-view {
        grid-template-columns: repeat(2, 1fr);
    }

    .glass-card,
    .task-card {
        break-inside: avoid;
    }
}

/* ============================================
   HIGH DPI / RETINA DISPLAYS
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .app-background {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ============================================
   REDUCED MOTION PREFERENCE
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   DARK MODE SYSTEM PREFERENCE (already dark)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Already using dark theme */
}

/* ============================================
   HOVER CAPABILITY CHECK
   ============================================ */
@media (hover: none) {
    /* Touch devices - show elements that appear on hover */
    .task-checkbox-wrapper {
        opacity: 1;
        left: 0;
    }

    .task-card .task-content {
        transform: translateX(32px);
    }

    .task-actions {
        opacity: 1;
    }

    .drag-handle {
        opacity: 0.5;
    }
}
