/**
 * Verdara Tax CRM - Responsive Styles
 *
 * Mobile-first responsive design
 *
 * @package Verdara
 * @version 1.0.0
 */

/* ============================================
   MOBILE NAVIGATION
   ============================================ */

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: var(--text-2xl);
    cursor: pointer;
    padding: var(--space-2);
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

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

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

@media (max-width: 1024px) {
    .container {
        padding: 0 var(--space-4);
    }

    /* Adjust grid layouts */
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }

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

    /* Stat cards */
    .stat-card-value {
        font-size: var(--text-3xl);
    }

    /* Document categories */
    .document-categories {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    /* Invoice header */
    .invoice-header {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    .invoice-details {
        text-align: left;
    }
}

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

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
        --header-height: 60px;
    }

    /* Typography adjustments */
    h1 { font-size: var(--text-3xl); }
    h2 { font-size: var(--text-2xl); }
    h3 { font-size: var(--text-xl); }

    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: block;
    }

    /* Hide sidebars by default on mobile */
    .client-sidebar,
    .organizer-sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-base);
    }

    .client-sidebar.mobile-open,
    .organizer-sidebar.mobile-open {
        transform: translateX(0);
    }

    /* Adjust main content */
    .client-main,
    .organizer-main {
        margin-left: 0;
    }

    /* Header adjustments */
    .client-header,
    .organizer-header {
        padding: 0 var(--space-4);
    }

    /* Content padding */
    .client-content,
    .organizer-content {
        padding: var(--space-4);
    }

    /* Single column grids */
    .dashboard-grid,
    .analytics-grid,
    .quick-actions,
    .document-categories {
        grid-template-columns: 1fr;
    }

    /* Welcome banner */
    .welcome-banner {
        padding: var(--space-6);
    }

    .welcome-title {
        font-size: var(--text-2xl);
    }

    .welcome-subtitle {
        font-size: var(--text-base);
    }

    /* Stat cards */
    .stat-card-value {
        font-size: var(--text-3xl);
    }

    /* Refund card */
    .refund-card {
        padding: var(--space-6);
    }

    .refund-amount {
        font-size: 36px;
    }

    /* Progress tracker - vertical on mobile */
    .progress-tracker {
        flex-direction: column;
        align-items: flex-start;
        padding: var(--space-4) 0 var(--space-4) var(--space-8);
    }

    .progress-tracker::before {
        top: 0;
        left: 16px;
        right: auto;
        bottom: 0;
        width: 2px;
        height: 100%;
    }

    .progress-step {
        flex-direction: row;
        width: 100%;
        margin-bottom: var(--space-4);
    }

    .progress-icon {
        width: 40px;
        height: 40px;
        font-size: var(--text-xs);
    }

    .progress-label {
        text-align: left;
    }

    /* Category cards */
    .category-card {
        padding: var(--space-4);
    }

    .category-icon {
        width: 48px;
        height: 48px;
        font-size: var(--text-2xl);
    }

    /* Document card */
    .document-card {
        flex-wrap: wrap;
    }

    .document-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: var(--space-2);
    }

    /* Quick actions */
    .quick-action-icon {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }

    /* Data table - make scrollable */
    .data-table {
        overflow-x: auto;
    }

    .data-table table {
        min-width: 600px;
    }

    /* Client row - stack on mobile */
    .client-row {
        grid-template-columns: 1fr;
        gap: var(--space-3);
        padding: var(--space-4);
    }

    /* Clients header */
    .clients-header {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-4);
    }

    .clients-search {
        flex-direction: column;
        max-width: 100%;
    }

    /* Calendar - reduce padding */
    .calendar-container {
        padding: var(--space-4);
    }

    .calendar-header {
        flex-direction: column;
        gap: var(--space-4);
        align-items: stretch;
    }

    .calendar-nav {
        justify-content: space-between;
    }

    .calendar-day {
        min-height: 60px;
        padding: var(--space-2);
        font-size: var(--text-xs);
    }

    /* Invoice builder */
    .invoice-builder {
        padding: var(--space-4);
    }

    .invoice-header {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .invoice-details {
        text-align: left;
    }

    .invoice-number {
        font-size: var(--text-xl);
    }

    .invoice-item {
        grid-template-columns: 1fr;
        gap: var(--space-2);
        padding: var(--space-4);
        background: var(--color-gray-50);
        border-radius: var(--radius-md);
        margin-bottom: var(--space-3);
        border-bottom: none;
    }

    .invoice-totals {
        padding-right: 0;
    }

    .invoice-total-row {
        font-size: var(--text-base);
    }

    .invoice-total-row.grand-total {
        font-size: var(--text-xl);
    }

    /* Settings */
    .settings-section {
        padding: var(--space-4);
    }

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

    .settings-control {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }

    /* Forms */
    .form-group {
        margin-bottom: var(--space-4);
    }

    /* Buttons */
    .btn {
        width: 100%;
        justify-content: center;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
    }

    /* Modal adjustments */
    .modal {
        width: 95%;
        padding: var(--space-6);
        max-height: 85vh;
    }

    .modal-title {
        font-size: var(--text-xl);
    }

    /* Card adjustments */
    .card {
        padding: var(--space-4);
    }

    .card-header,
    .card-footer {
        padding-bottom: var(--space-3);
        padding-top: var(--space-3);
    }

    /* Timeline */
    .timeline {
        padding-left: var(--space-6);
    }

    .timeline-item::before {
        left: -31px;
    }

    /* Empty state */
    .empty-state {
        padding: var(--space-8);
    }

    .empty-state-icon {
        width: 60px;
        height: 60px;
        font-size: 30px;
    }

    .empty-state-title {
        font-size: var(--text-xl);
    }

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

    /* Metric cards */
    .metric-value {
        font-size: var(--text-3xl);
    }

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

    .upload-icon {
        width: 56px;
        height: 56px;
        font-size: var(--text-2xl);
    }

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

    /* Appointments list */
    .appointment-item {
        padding: var(--space-3);
    }

    /* Messages widget */
    .message-item {
        padding: var(--space-3);
    }

    /* Progress stats */
    .progress-stats {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   SMALL MOBILE (< 480px)
   ============================================ */

@media (max-width: 480px) {
    /* Further reduce font sizes */
    h1 { font-size: var(--text-2xl); }
    h2 { font-size: var(--text-xl); }
    h3 { font-size: var(--text-lg); }

    /* Reduce spacing */
    .container {
        padding: 0 var(--space-3);
    }

    .client-content,
    .organizer-content {
        padding: var(--space-3);
    }

    /* Stat card value */
    .stat-card-value {
        font-size: var(--text-2xl);
    }

    /* Refund amount */
    .refund-amount {
        font-size: 28px;
    }

    /* Button sizing */
    .btn {
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-sm);
    }

    .btn-lg {
        padding: var(--space-3) var(--space-6);
        font-size: var(--text-base);
    }

    /* Form inputs */
    .form-input,
    .form-select,
    .form-textarea {
        font-size: var(--text-sm);
    }

    /* Table text */
    .data-table th,
    .data-table td {
        padding: var(--space-3);
        font-size: var(--text-xs);
    }

    /* Calendar */
    .calendar-day {
        min-height: 50px;
        font-size: 11px;
    }

    /* Progress icon */
    .progress-icon {
        width: 36px;
        height: 36px;
    }
}

/* ============================================
   LANDSCAPE ORIENTATION
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {
    /* Adjust header height for landscape */
    :root {
        --header-height: 50px;
    }

    /* Reduce vertical padding */
    .client-content,
    .organizer-content {
        padding: var(--space-4);
    }

    /* Modal height adjustment */
    .modal {
        max-height: 90vh;
    }
}

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

@media print {
    /* Hide navigation and non-essential elements */
    .client-sidebar,
    .organizer-sidebar,
    .client-header,
    .organizer-header,
    .mobile-menu-toggle,
    .btn,
    .quick-actions,
    .nav-item,
    .dropdown-menu {
        display: none !important;
    }

    /* Adjust layout for printing */
    .client-main,
    .organizer-main {
        margin-left: 0;
    }

    /* Remove shadows and backgrounds */
    .card,
    .stat-card,
    .document-card,
    .data-table {
        box-shadow: none !important;
        border: 1px solid #000;
    }

    /* Ensure content fits on page */
    body {
        font-size: 12pt;
    }

    /* Page breaks */
    .card,
    .invoice-builder {
        page-break-inside: avoid;
    }
}

/* ============================================
   ACCESSIBILITY - REDUCED MOTION
   ============================================ */

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

    .progress-bar::after {
        animation: none;
    }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: high) {
    .btn,
    .card,
    .form-input,
    .form-select {
        border-width: 2px;
    }

    .badge,
    .stat-card,
    .document-card {
        border: 2px solid currentColor;
    }
}
