/* COMPLETE RESPONSIVE.CSS - ENHANCED MOBILE-FIRST DESIGN */
/* Brand Colors: Primary #00ADB4 (teal), Secondary #008B94 (darker teal), Accent #5FDEE2 (lighter teal) */

/* =================================================================
   MOBILE-FIRST BASE IMPROVEMENTS
   ================================================================= */

/* Ensure proper viewport handling */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    touch-action: manipulation;
    scroll-behavior: smooth;
}

body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* Better tap targets */
button, a, input, select, textarea {
    min-height: 44px;
    min-width: 44px;
}

/* Prevent zoom on form inputs */
input, select, textarea {
    font-size: 16px !important;
}

/* =================================================================
   DESKTOP BASE STYLES (Default - 1025px and up)
   ================================================================= */

.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

.sidebar {
    width: 230px;
    min-width: 230px;
    background: white;
    border-right: 1px solid #e1e5e9;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    z-index: 1000;
    position: relative;
}

.sidebar.collapsed {
    width: 80px;
    min-width: 80px;
}

.main-content {
    flex: 1;
    background: #f8fafc;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Desktop sidebar elements */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e1e5e9;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: #00ADB4;
}

.sidebar-toggle {
    position: absolute;
    top: 20px;
    right: -15px;
    width: 30px;
    height: 30px;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1001;
}

.sidebar-toggle:hover {
    background: #f8fafc;
    transform: scale(1.1);
}

.sidebar-new-patient {
    padding: 16px 20px;
    border-bottom: 1px solid #e1e5e9;
}

.sidebar-new-patient-btn {
    width: 100%;
    padding: 12px 16px;
    background: #00ADB4;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sidebar-new-patient-btn:hover {
    background: #008B94;
    transform: translateY(-1px);
}

.new-patient-icon {
    width: 18px;
    height: 18px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

.nav-item:hover {
    background: #f8fafc;
    color: #374151;
}

.nav-item.active {
    background: #e0f7fa;
    color: #00ADB4;
    border-left-color: #00ADB4;
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid #e1e5e9;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #00ADB4;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-details {
    flex: 1;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}

.user-email {
    font-size: 12px;
    color: #6b7280;
}

/* Desktop header */
.header {
    padding: 24px 32px;
    background: white;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.greeting {
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
}

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

.mobile-header-row,
.mobile-logo,
.mobile-logo-text,
.mobile-new-patient-container,
.mobile-new-patient-btn {
    display: none;
}

/* Desktop stats */
.stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 16px 20px;
    background: #f8fafc;
}

.stat-card {
    background: white;
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #00ADB4;
    margin-bottom: 8px;
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* Desktop content area */
.content-area {
    flex: 1;
    padding: 0 32px 32px;
    overflow-y: auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 16px 0 0 0;
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.schedule-date {
    font-size: 14px;
    color: #6b7280;
}

/* Desktop filters */
.filters-container {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden;
}

.filters-toggle {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border-bottom: 1px solid #e1e5e9;
    transition: background-color 0.2s ease;
}

.filters-toggle:hover {
    background: #f1f5f9;
}

.filters-toggle-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filters-toggle-icon {
    width: 20px;
    height: 20px;
    color: #6b7280;
}

.filters-toggle-text {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.filter-indicator {
    background: #00ADB4;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.filters-toggle-arrow {
    width: 20px;
    height: 20px;
    color: #6b7280;
    transition: transform 0.2s ease;
}

.filters-container:not(.collapsed) .filters-toggle-arrow {
    transform: rotate(180deg);
}

.filters-content {
    padding: 20px;
}

.filters-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s ease;
}

.filter-input:focus {
    outline: none;
    border-color: #00ADB4;
    box-shadow: 0 0 0 3px rgba(0, 173, 180, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
    padding-top: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}

.checkbox-label input[type="checkbox"] {
    min-width: 16px;
    min-height: 16px;
    width: 16px;
    height: 16px;
}

.filters-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.quick-filters {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    gap: 10px;
}

.quick-filters button {
    margin-bottom: 0 !important;
    margin-right: 10px;
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-outline {
    background: white;
    color: #6b7280;
    border-color: #d1d5db;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-primary {
    background: #00ADB4;
    color: white;
    border-color: #00ADB4;
}

.btn-primary:hover {
    background: #008B94;
}

/* Desktop table */
.schedule-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    background: #f8fafc;
    border-bottom: 1px solid #e1e5e9;
}

.table-body {
    display: block;
}

.table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    border-bottom: 1px solid #e1e5e9;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.table-row:hover {
    background: #f8fafc;
}

.table-row:last-child {
    border-bottom: none;
}

.header-cell,
.table-cell {
    padding: 16px 20px;
    text-align: left;
    display: flex;
    align-items: center;
    font-size: 14px;
}

.header-cell {
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
}

.patient-name {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.patient-contact {
    font-size: 13px;
    color: #6b7280;
}

.consultation-time {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.status-badge {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
}

.status-badge.status-not-seen {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fbbf24;
}

.status-badge.status-progress {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.status-badge.status-paused {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #fc8181;
}

.status-badge.status-completed {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.status-badge.status-cancelled {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    min-height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Loading and empty states */
.loading-container,
.empty-state {
    padding: 60px 32px;
    text-align: center;
    background: white;
    border-radius: 12px;
    margin: 24px 0;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #00ADB4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state-text {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}

.empty-state-subtext {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

/* Recording view */
.recording-view-container {
    display: flex;
    height: 100vh;
}

.recording-sidebar {
    width: 230px;
    background: white;
    border-right: 1px solid #e1e5e9;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.recording-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.recording-header {
    padding: 12px 32px;
    background: white;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.session-info h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 8px 0;
}

.session-details {
    display: flex;
    gap: 16px;
    color: #6b7280;
    font-size: 14px;
}

.recording-content {
    flex: 1;
    padding: 10px 32px;
    background: #f8fafc;
}

.sidebar-schedule-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sidebar-patient-item {
    padding: 16px;
    border-bottom: 1px solid #e1e5e9;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.sidebar-patient-item:hover {
    background: #f8fafc;
}

.sidebar-patient-item.active {
    background: #e0f7fa;
    border-right: 3px solid #00ADB4;
}

.sidebar-patient-info {
    margin-bottom: 8px;
}

.sidebar-patient-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.sidebar-patient-contact {
    font-size: 12px;
    color: #6b7280;
}

.sidebar-patient-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-status-badge {
    padding: 4px 8px;
    font-size: 10px;
    border-radius: 12px;
    font-weight: 600;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.notification.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.notification.warning {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fcd34d;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.modal {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e1e5e9;
    position: relative;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 24px;
}

.modal-actions {
    padding: 16px 24px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid #e1e5e9;
}

/* Forms */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #00ADB4;
    box-shadow: 0 0 0 3px rgba(0, 173, 180, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.radio-item:hover {
    border-color: #00ADB4;
    background: #f0fdff;
}

.radio-item input[type="radio"] {
    margin: 0;
}

/* =================================================================
   LARGE DESKTOP STYLES (1441px and up)
   ================================================================= */
@media (min-width: 1441px) {
    .sidebar {
        width: 280px;
        min-width: 280px;
    }
    
    .header {
        padding: 28px 40px;
    }
    
    .greeting {
        font-size: 26px;
    }
    
    .stats-container {
        padding: 28px 40px;
        gap: 28px;
    }
    
    .stat-card {
        padding: 20px 18px;
    }
    
    .stat-number {
        font-size: 36px;
    }
    
    .content-area {
        padding: 0 40px 40px;
    }
    
    .section-title {
        font-size: 26px;
    }
}

/* =================================================================
   TABLET STYLES (769px - 1024px)
   ================================================================= */
@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar {
        width: 220px;
        min-width: 220px;
    }
    
    .sidebar.collapsed {
        width: 70px;
        min-width: 70px;
    }
    
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding: 20px 24px;
    }
    
    .stat-card {
        padding: 20px 16px;
        min-height: 100px;
    }
    
    .header {
        padding: 20px 24px;
        flex-wrap: wrap;
        gap: 16px;
    }
    
    .greeting {
        font-size: 22px;
    }
    
    .content-area {
        padding: 0 24px 20px;
    }
    
    .modal {
        width: 90vw;
        max-width: 600px;
        margin: 20px auto;
    }
    
    .table-header,
    .table-row {
        grid-template-columns: 2fr 1fr minmax(120px, 1fr);
    }
    
    .header-cell:nth-child(2),
    .table-cell:nth-child(2) {
        display: none;
    }
    
    .recording-sidebar {
        width: 260px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .filters-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .filters-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
}

/* =================================================================
   SMALL TABLET STYLES (481px - 768px)
   ================================================================= */
@media (max-width: 768px) and (min-width: 481px) {
    .sidebar {
        width: 200px;
        min-width: 200px;
    }
    
    .sidebar.collapsed {
        width: 60px;
        min-width: 60px;
    }
    
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 16px 20px;
    }
    
    .stat-card {
        padding: 16px 12px;
        min-height: 90px;
    }
    
    .stat-number {
        font-size: 26px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .header {
        padding: 16px 20px;
    }
    
    .greeting {
        font-size: 20px;
    }
    
    .content-area {
        padding: 0 20px 20px;
    }
    
    .section-title {
        font-size: 20px;
    }
    
    .table-header,
    .table-row {
        grid-template-columns: 2fr minmax(120px, 1fr);
    }
    
    .header-cell:nth-child(2),
    .table-cell:nth-child(2),
    .header-cell:nth-child(3),
    .table-cell:nth-child(3) {
        display: none;
    }
}

/* =================================================================
   MOBILE STYLES (max-width: 480px) - COMPLETE MOBILE TRANSFORMATION
   ================================================================= */
@media (max-width: 480px) {
    /* Prevent horizontal scrolling */
    body {
        overflow-x: hidden;
        width: 100%;
    }
    
    /* =================================================================
       MOBILE APP CONTAINER - COMPLETE RESTRUCTURE
       ================================================================= */
    .app-container {
        flex-direction: column !important;
        height: 100vh !important;
        width: 100% !important;
        position: relative !important;
        overflow: hidden !important;
    }
    
    /* =================================================================
       MOBILE BOTTOM NAVIGATION (Transformed Sidebar)
       ================================================================= */
    .sidebar {
        width: 100% !important;
        min-width: 100% !important;
        height: 70px !important;
        flex-direction: row !important;
        padding: 0 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        order: 3 !important;
        background: white !important;
        border-right: none !important;
        border-top: 1px solid #e1e5e9 !important;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1) !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
        align-items: center !important;
        justify-content: space-around !important;
    }
    
    .sidebar.collapsed {
        width: 100% !important;
        height: 70px !important;
    }
    
    /* Hide desktop sidebar elements on mobile */
    .sidebar-header,
    .sidebar-toggle {
        display: none !important;
    }
    
    /* Transform sidebar new patient button for mobile bottom nav */
    .sidebar-new-patient {
        order: 1 !important;
        padding: 8px 12px !important;
        border: none !important;
        flex-shrink: 0 !important;
        border-bottom: none !important;
    }
    
    .sidebar-new-patient-btn {
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 8px 12px !important;
        min-width: 60px !important;
        height: 50px !important;
        font-size: 10px !important;
        border-radius: 8px !important;
        background: #00ADB4 !important;
        color: white !important;
        border: none !important;
        gap: 4px !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        width: auto !important;
    }
    
    .sidebar-new-patient-btn:hover {
        background: #008B94 !important;
        transform: translateY(-1px) !important;
    }
    
    .new-patient-icon {
        width: 20px !important;
        height: 20px !important;
        margin: 0 !important;
        background: rgba(255, 255, 255, 0.2) !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .new-patient-text {
        font-size: 10px !important;
        font-weight: 600 !important;
        text-align: center !important;
        line-height: 1 !important;
        margin: 0 !important;
    }
    
    /* Mobile navigation items */
    .nav-item {
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 8px 12px !important;
        margin: 0 !important;
        min-width: 60px !important;
        flex-shrink: 0 !important;
        font-size: 10px !important;
        text-align: center !important;
        border-left: none !important;
        border-radius: 8px !important;
        gap: 4px !important;
        height: 50px !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        border-bottom: none !important;
    }
    
    .nav-item.active {
        background-color: #e0f7fa !important;
        color: #00ADB4 !important;
        border: none !important;
    }
    
    .nav-item:hover {
        background-color: #f0f9ff !important;
    }
    
    .nav-icon {
        margin-right: 0 !important;
        width: 20px !important;
        height: 20px !important;
        margin-bottom: 2px !important;
    }
    
    .nav-icon i {
        width: 18px !important;
        height: 18px !important;
    }
    
    /* Mobile user info in bottom nav */
    .user-info {
        margin-top: 0 !important;
        margin-left: 0 !important;
        padding: 8px 12px !important;
        border-top: none !important;
        border-left: none !important;
        flex-shrink: 0 !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 4px !important;
        min-width: 60px !important;
        height: 50px !important;
        order: 4 !important;
    }
    
    .user-avatar {
        width: 20px !important;
        height: 20px !important;
        font-size: 9px !important;
        margin-bottom: 2px !important;
    }
    
    .user-details {
        display: none !important;
    }
    
    /* =================================================================
       MOBILE MAIN CONTENT AREA
       ================================================================= */
    .main-content {
        order: 1 !important;
        height: calc(100vh - 70px) !important;
        margin-bottom: 0 !important;
        overflow-y: auto !important;
        background: #f8fafc !important;
        width: 100% !important;
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* =================================================================
       MOBILE HEADER - PROMINENT LOGO AND ACTIONS
       ================================================================= */
    .header {
        padding: 16px 20px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
        background: white !important;
        border-bottom: 1px solid #e1e5e9 !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
    }
    
    /* Show mobile elements */
    .mobile-header-row {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
    }
    
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 40px !important;
        height: 40px !important;
        background: none !important;
        border: none !important;
        color: #374151 !important;
        border-radius: 8px !important;
        cursor: pointer !important;
        transition: background-color 0.2s ease !important;
    }
    
    .mobile-menu-toggle:hover {
        background: #f3f4f6 !important;
    }
    
    .mobile-logo {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        flex: 1 !important;
        justify-content: center !important;
    }
    
    .mobile-logo img {
        width: 32px !important;
        height: 32px !important;
        object-fit: contain !important;
    }
    
    .mobile-logo-text {
        font-size: 20px !important;
        font-weight: 700 !important;
        color: #00ADB4 !important;
        margin: 0 !important;
        display: block !important;
    }
    
    .greeting {
        font-size: 18px !important;
        font-weight: 600 !important;
        color: #1f2937 !important;
        text-align: center !important;
        margin: 8px 0 !important;
    }
    
    .mobile-new-patient-container {
        width: 100% !important;
        margin-top: 8px !important;
        display: block !important;
    }
    
    .mobile-new-patient-btn {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 16px 20px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        background: #00ADB4 !important;
        color: white !important;
        border: none !important;
        border-radius: 12px !important;
        min-height: 52px !important;
        gap: 8px !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        box-shadow: 0 2px 4px rgba(0, 173, 180, 0.2) !important;
    }
    
    .mobile-new-patient-btn:hover {
        background: #008B94 !important;
        transform: translateY(-1px) !important;
        box-shadow: 0 4px 8px rgba(0, 173, 180, 0.3) !important;
    }
    
    .mobile-plus-icon {
        width: 20px !important;
        height: 20px !important;
        background: rgba(255, 255, 255, 0.2) !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* =================================================================
       MOBILE STATS GRID
       ================================================================= */
    .stats-container {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        padding: 14px 18px !important;
        gap: 10px !important;
        background: #f8fafc !important;
    }
    
    .stat-card {
        background: white !important;
        padding: 14px 10px !important;
        border-radius: 12px !important;
        text-align: center !important;
        min-height: 80px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
        transition: transform 0.2s ease !important;
    }
    
    .stat-card:active {
        transform: scale(0.98) !important;
    }
    
    .stat-number {
        font-size: 24px !important;
        font-weight: 700 !important;
        color: #00ADB4 !important;
        margin-bottom: 4px !important;
        line-height: 1 !important;
    }
    
    .stat-label {
        font-size: 11px !important;
        color: #6b7280 !important;
        font-weight: 500 !important;
        line-height: 1.2 !important;
    }
    
    /* =================================================================
       MOBILE CONTENT AREA - FULL SCREEN SCROLLING
       ================================================================= */
    .content-area {
        flex: 1 !important;
        padding: 0 20px 20px !important;
        overflow-y: visible !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .section-header {
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
        margin-bottom: 16px !important;
        text-align: center !important;
        padding: 16px 0 !important;
    }
    
    .section-title {
        font-size: 18px !important;
        font-weight: 600 !important;
        color: #1f2937 !important;
        margin: 0 !important;
    }
    
    .schedule-date {
        font-size: 14px !important;
        color: #6b7280 !important;
        margin: 0 !important;
    }
    
    /* =================================================================
       MOBILE FILTERS
       ================================================================= */
    .filters-container {
        margin: 0 20px 16px !important;
        border-radius: 12px !important;
        background: white !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    }
    
    .filters-toggle {
        padding: 14px 18px !important;
        cursor: pointer !important;
        border-radius: 12px !important;
    }
    
    .filters-content {
        padding: 0 18px 18px !important;
        border-radius: 0 0 12px 12px !important;
    }
    
    .filters-row {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .filter-group {
        min-width: 100% !important;
    }
    
    .filter-input {
        padding: 12px 14px !important;
        font-size: 16px !important;
        border-radius: 8px !important;
        min-height: 44px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .filters-actions {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    
    .quick-filters {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
    
    .btn-sm {
        padding: 10px 12px !important;
        font-size: 14px !important;
        min-height: 44px !important;
    }
    
    /* =================================================================
       MOBILE TABLE TO CARDS TRANSFORMATION
       ================================================================= */
    .schedule-table {
        border-radius: 12px !important;
        overflow: visible !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        width: 100% !important;
    }
    
    .table-header {
        display: none !important;
    }
    
    .table-body {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        width: 100% !important;
        max-height: none !important;
        overflow-y: visible !important;
        padding-bottom: 80px !important; /* Space above bottom nav */
    }
    
    .table-row {
        display: block !important;
        background: white !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 12px !important;
        padding: 16px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
        transition: all 0.2s ease !important;
        cursor: pointer !important;
        width: 100% !important;
        box-sizing: border-box !important;
        margin-bottom: 0 !important;
        grid-template-columns: none !important;
    }
    
    .table-row:active {
        background: #f8fafc !important;
        transform: scale(0.98) !important;
    }
    
    .table-cell {
        display: block !important;
        padding: 0 !important;
        margin-bottom: 8px !important;
        border-bottom: none !important;
        width: 100% !important;
        text-align: left !important;
        align-items: flex-start !important;
    }
    
    .table-cell:last-child {
        margin-bottom: 0 !important;
        text-align: left !important;
    }
    
    .table-cell:before {
        content: attr(data-label) !important;
        font-weight: 600 !important;
        color: #6b7280 !important;
        display: block !important;
        margin-bottom: 4px !important;
        font-size: 11px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
    }
    
    /* Mobile card content styling */
    .patient-name {
        font-size: 16px !important;
        font-weight: 600 !important;
        color: #1f2937 !important;
        margin-bottom: 4px !important;
        line-height: 1.3 !important;
    }
    
    .patient-contact {
        font-size: 13px !important;
        color: #6b7280 !important;
        margin-bottom: 8px !important;
        line-height: 1.3 !important;
    }
    
    .consultation-time {
        font-size: 13px !important;
        color: #374151 !important;
        font-weight: 500 !important;
        line-height: 1.3 !important;
    }
    
    .status-badge {
        padding: 6px 12px !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        border-radius: 16px !important;
        display: inline-block !important;
        margin-bottom: 12px !important;
        min-width: auto !important;
    }
    
    .action-buttons {
        display: flex !important;
        gap: 8px !important;
        justify-content: stretch !important;
        margin-top: 8px !important;
    }
    
    .action-btn {
        flex: 1 !important;
        padding: 10px 14px !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        min-width: auto !important;
        min-height: 40px !important;
        border-radius: 8px !important;
        justify-content: center !important;
        display: flex !important;
        align-items: center !important;
    }
    
    /* =================================================================
       MOBILE STATES AND NOTIFICATIONS
       ================================================================= */
    .loading-container,
    .empty-state {
        padding: 40px 20px !important;
        margin: 16px !important;
        text-align: center !important;
        border-radius: 12px !important;
        background: white !important;
    }
    
    .empty-state-icon {
        font-size: 40px !important;
        margin-bottom: 12px !important;
        opacity: 0.6 !important;
    }
    
    .empty-state-text {
        font-size: 16px !important;
        font-weight: 600 !important;
        color: #1f2937 !important;
        margin-bottom: 6px !important;
    }
    
    .empty-state-subtext {
        font-size: 13px !important;
        color: #6b7280 !important;
        line-height: 1.4 !important;
    }
    
    .loading-text {
        font-size: 14px !important;
        color: #6b7280 !important;
        margin-top: 12px !important;
    }
    
    /* =================================================================
       MOBILE NOTIFICATIONS
       ================================================================= */
    .notification {
        top: 16px !important;
        right: 16px !important;
        left: 16px !important;
        max-width: none !important;
        font-size: 14px !important;
        padding: 16px 20px !important;
        border-radius: 12px !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
    }
    
    /* =================================================================
       MOBILE MODAL IMPROVEMENTS
       ================================================================= */
    .modal-overlay {
        padding: 0 !important;
        align-items: flex-end !important;
    }
    
    .modal {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        border-radius: 16px 16px 0 0 !important;
        max-height: 90vh !important;
        animation: slideUpFromBottom 0.3s ease-out !important;
    }
    
    @keyframes slideUpFromBottom {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    .modal-header {
        padding: 20px 24px 16px !important;
        text-align: center !important;
        position: relative !important;
    }
    
    .modal-title {
        font-size: 18px !important;
        font-weight: 600 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .modal-close {
        top: 16px !important;
        right: 20px !important;
        width: 36px !important;
        height: 36px !important;
        font-size: 20px !important;
    }
    
    .modal-actions {
        padding: 16px 24px 24px !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .modal-actions .btn {
        width: 100% !important;
        min-height: 52px !important;
        font-size: 16px !important;
        font-weight: 600 !important;
    }
    
    /* =================================================================
       MOBILE FORMS
       ================================================================= */
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .form-group {
        margin-bottom: 20px !important;
    }
    
    .form-label {
        font-size: 14px !important;
        font-weight: 600 !important;
        margin-bottom: 8px !important;
        color: #374151 !important;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        padding: 14px 16px !important;
        font-size: 16px !important;
        border-radius: 8px !important;
        min-height: 52px !important;
        border: 2px solid #e5e7eb !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .form-input:focus,
    .form-select:focus,
    .form-textarea:focus {
        border-color: #00ADB4 !important;
        box-shadow: 0 0 0 3px rgba(0, 173, 180, 0.1) !important;
    }
    
    .radio-group {
        flex-direction: column !important;
        gap: 16px !important;
    }
    
    .radio-item {
        padding: 16px !important;
        border: 2px solid #e5e7eb !important;
        border-radius: 8px !important;
        background: white !important;
        min-height: 52px !important;
    }
    
    /* =================================================================
       MOBILE RECORDING VIEW
       ================================================================= */
    .recording-view-container {
        flex-direction: column !important;
        height: calc(100vh - 70px) !important;
        margin-bottom: 0 !important;
        width: 100% !important;
    }
    
    .recording-sidebar {
        width: 100% !important;
        height: 120px !important;
        border-right: none !important;
        border-bottom: 1px solid #e1e5e9 !important;
        order: 1 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        background: white !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 90 !important;
        flex-direction: row !important;
    }
    
    .recording-main-content {
        order: 2 !important;
        flex: 1 !important;
        overflow-y: auto !important;
        padding-top: 0 !important;
    }
    
    .recording-header {
        padding: 20px 24px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px !important;
        text-align: center !important;
    }
    
    .recording-header .session-info h2 {
        font-size: 20px !important;
        margin-bottom: 8px !important;
    }
    
    .session-details {
        flex-direction: column !important;
        gap: 8px !important;
        text-align: center !important;
    }
    
    .recording-content {
        padding: 20px 24px !important;
    }
    
    .sidebar-schedule-list {
        display: flex !important;
        flex-direction: row !important;
        gap: 12px !important;
        padding: 12px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        height: 120px !important;
        align-items: center !important;
    }
    
    .sidebar-patient-item {
        padding: 8px !important;
        border-bottom: none !important;
        border-radius: 8px !important;
        background: white !important;
        border: 2px solid #e5e7eb !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        flex-shrink: 0 !important;
        width: 80px !important;
        height: 90px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        text-align: center !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
    }
    
    .sidebar-patient-item:hover {
        background: #e0f7fa !important;
        border-color: #00ADB4 !important;
        transform: translateY(-2px) !important;
        box-shadow: 0 2px 6px rgba(0,173,180,0.2) !important;
    }
    
    .sidebar-patient-item.active {
        background: #e0f7fa !important;
        border-color: #00ADB4 !important;
        border-width: 3px !important;
        box-shadow: 0 2px 8px rgba(0,173,180,0.3) !important;
    }
    
    .sidebar-patient-info {
        margin-bottom: 0 !important;
        text-align: center !important;
        width: 100% !important;
    }
    
    .sidebar-patient-name {
        font-size: 9px !important;
        font-weight: 600 !important;
        color: #1f2937 !important;
        margin-bottom: 2px !important;
        line-height: 1.1 !important;
        max-width: 72px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        display: block !important;
    }
    
    .sidebar-patient-contact {
        font-size: 8px !important;
        color: #6b7280 !important;
        line-height: 1 !important;
        margin: 0 0 4px 0 !important;
        max-width: 72px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    
    .sidebar-patient-status {
        margin-top: 2px !important;
        justify-content: center !important;
        width: 100% !important;
    }
    
    .sidebar-status-badge {
        padding: 1px 4px !important;
        font-size: 7px !important;
        border-radius: 6px !important;
        max-width: 70px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        display: block !important;
        line-height: 1.2 !important;
    }
    
    /* Scrollbar styling for horizontal patient list */
    .sidebar-schedule-list::-webkit-scrollbar {
        height: 4px !important;
    }
    
    .sidebar-schedule-list::-webkit-scrollbar-track {
        background: #f1f1f1 !important;
        border-radius: 2px !important;
    }
    
    .sidebar-schedule-list::-webkit-scrollbar-thumb {
        background: #c1c1c1 !important;
        border-radius: 2px !important;
    }
    
    .sidebar-schedule-list::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8 !important;
    }
}

/* =================================================================
   VERY SMALL MOBILE STYLES (max-width: 360px)
   ================================================================= */
@media (max-width: 360px) {
    .stats-container {
        grid-template-columns: 1fr !important;
        padding: 10px 14px !important;
        gap: 10px !important;
    }
    
    .stat-card {
        padding: 12px !important;
        min-height: 70px !important;
    }
    
    .stat-number {
        font-size: 20px !important;
    }
    
    .stat-label {
        font-size: 10px !important;
    }
    
    .header {
        padding: 12px 16px !important;
    }
    
    .content-area {
        padding: 0 16px 16px !important;
    }
    
    .greeting {
        font-size: 16px !important;
    }
    
    .section-title {
        font-size: 16px !important;
    }
    
    .nav-item {
        padding: 6px 8px !important;
        font-size: 9px !important;
        min-width: 50px !important;
        height: 45px !important;
    }
    
    .nav-icon i {
        width: 16px !important;
        height: 16px !important;
    }
    
    .user-info {
        min-width: 50px !important;
        padding: 6px 8px !important;
        height: 45px !important;
    }
    
    .user-avatar {
        width: 18px !important;
        height: 18px !important;
        font-size: 8px !important;
    }
    
    .sidebar {
        height: 60px !important;
    }
    
    .main-content {
        height: calc(100vh - 60px) !important;
    }
    
    .mobile-new-patient-btn {
        padding: 12px 16px !important;
        font-size: 14px !important;
        min-height: 44px !important;
    }
    
    .table-row {
        padding: 12px !important;
    }
    
    .patient-name {
        font-size: 14px !important;
    }
    
    .patient-contact {
        font-size: 12px !important;
    }
    
    .action-btn {
        padding: 8px 10px !important;
        font-size: 12px !important;
        min-height: 36px !important;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        padding: 10px 12px !important;
        min-height: 44px !important;
    }
    
    .recording-sidebar {
        height: 100px !important;
    }
    
    .sidebar-patient-item {
        width: 70px !important;
        height: 80px !important;
    }
    
    .sidebar-patient-name {
        font-size: 8px !important;
        max-width: 66px !important;
    }
    
    .sidebar-patient-contact {
        font-size: 7px !important;
    }
    
    .filters-container {
        margin: 0 16px 12px !important;
    }
    
    .filters-toggle {
        padding: 12px 16px !important;
    }
    
    .filters-content {
        padding: 0 16px 16px !important;
    }
    
    .quick-filters {
        grid-template-columns: 1fr !important;
        gap: 6px !important;
    }
    
    .btn-sm {
        min-height: 40px !important;
    }
}

/* =================================================================
   LANDSCAPE ORIENTATION OPTIMIZATIONS
   ================================================================= */
@media (max-width: 768px) and (orientation: landscape) {
    .main-content {
        height: calc(100vh - 50px) !important;
        margin-bottom: 0 !important;
    }
    
    .sidebar {
        height: 50px !important;
    }
    
    .nav-item {
        padding: 4px 8px !important;
        font-size: 9px !important;
        min-width: 50px !important;
        height: 42px !important;
    }
    
    .nav-icon i {
        width: 14px !important;
        height: 14px !important;
    }
    
    .user-info {
        padding: 4px 8px !important;
        min-width: 50px !important;
        height: 42px !important;
    }
    
    .user-avatar {
        width: 16px !important;
        height: 16px !important;
        font-size: 8px !important;
    }
    
    .stats-container {
        grid-template-columns: repeat(4, 1fr) !important;
        padding: 8px 16px !important;
        gap: 8px !important;
    }
    
    .stat-card {
        padding: 8px !important;
        min-height: 60px !important;
    }
    
    .stat-number {
        font-size: 18px !important;
        margin-bottom: 2px !important;
    }
    
    .stat-label {
        font-size: 9px !important;
    }
    
    .header {
        padding: 8px 16px !important;
    }
    
    .greeting {
        font-size: 16px !important;
    }
    
    .mobile-new-patient-btn {
        padding: 10px 16px !important;
        min-height: 40px !important;
        font-size: 14px !important;
    }
    
    .recording-sidebar {
        height: 80px !important;
    }
    
    .sidebar-patient-item {
        width: 60px !important;
        height: 70px !important;
    }
}

/* =================================================================
   ACCESSIBILITY & PERFORMANCE
   ================================================================= */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading-spinner {
        animation: none;
        border-top-color: transparent;
    }
    
    .modal {
        animation: none;
    }
    
    .table-row:hover,
    .table-row:active {
        transform: none !important;
    }
    
    .stat-card:hover,
    .stat-card:active {
        transform: none !important;
    }
    
    .sidebar-patient-item:hover {
        transform: none !important;
    }
    
    .mobile-new-patient-btn:hover {
        transform: none !important;
    }
}

@media (prefers-contrast: high) {
    .table-row {
        border-width: 2px !important;
    }
    
    .status-badge {
        border-width: 2px !important;
    }
    
    .btn {
        border-width: 2px !important;
        border-style: solid !important;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        border-width: 3px !important;
    }
    
    .modal {
        border: 3px solid #000 !important;
    }
    
    .notification {
        border-width: 2px !important;
        border-style: solid !important;
    }
    
    .sidebar-patient-item {
        border-width: 3px !important;
    }
    
    .stat-card {
        border: 2px solid #e1e5e9 !important;
    }
}

/* =================================================================
   PRINT STYLES
   ================================================================= */
@media print {
    .sidebar,
    .header .mobile-new-patient-container,
    .header .mobile-header-row,
    .modal-overlay,
    .notification,
    .action-buttons,
    .filters-container,
    .mobile-menu-toggle,
    .recording-sidebar {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    .app-container {
        flex-direction: column !important;
        height: auto !important;
    }
    
    .header {
        padding: 16px !important;
        border-bottom: 2px solid #000 !important;
        page-break-after: avoid !important;
    }
    
    .greeting {
        font-size: 18px !important;
        color: #000 !important;
    }
    
    .stats-container {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
        page-break-inside: avoid !important;
        padding: 16px !important;
    }
    
    .stat-card {
        border: 1px solid #000 !important;
        background: white !important;
        padding: 12px !important;
    }
    
    .stat-number {
        color: #000 !important;
    }
    
    .content-area {
        padding: 16px !important;
    }
    
    .table-row {
        break-inside: avoid !important;
        box-shadow: none !important;
        border: 1px solid #000 !important;
        margin-bottom: 8px !important;
        padding: 12px !important;
        page-break-inside: avoid !important;
    }
    
    .table-cell:before {
        font-weight: bold !important;
        color: #000 !important;
    }
    
    .patient-name {
        font-weight: bold !important;
        color: #000 !important;
    }
    
    .status-badge {
        border: 1px solid #000 !important;
        background: transparent !important;
        color: #000 !important;
    }
    
    .section-header {
        page-break-after: avoid !important;
        border-bottom: 1px solid #000 !important;
        padding-bottom: 8px !important;
        margin-bottom: 16px !important;
    }
    
    .section-title {
        color: #000 !important;
    }
    
    .schedule-date {
        color: #000 !important;
    }
    
    /* Hide mobile-specific elements in print */
    .mobile-logo,
    .mobile-logo-text,
    .mobile-plus-icon {
        display: none !important;
    }
    
    /* Ensure good print layout */
    body {
        font-size: 12pt !important;
        line-height: 1.4 !important;
    }
    
    .table-body {
        padding-bottom: 0 !important;
    }
}

/* =================================================================
   HIGH DPI / RETINA DISPLAY OPTIMIZATIONS
   ================================================================= */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo-icon,
    .mobile-logo img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    
    .loading-spinner {
        border-width: 2px;
    }
    
    @media (max-width: 480px) {
        .table-row {
            box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1) !important;
        }
        
        .stat-card {
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
        }
        
        .sidebar-patient-item {
            box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
        }
    }
}

/* =================================================================
   DARK MODE SUPPORT (if needed in future)
   ================================================================= */
@media (prefers-color-scheme: dark) {
    /* Future dark mode styles would go here */
    /* Keeping placeholder for future implementation */
}

/* =================================================================
   FOCUS STYLES FOR ACCESSIBILITY
   ================================================================= */
.nav-item:focus,
.sidebar-new-patient-btn:focus,
.mobile-new-patient-btn:focus,
.action-btn:focus,
.table-row:focus,
.sidebar-patient-item:focus {
    outline: 3px solid #00ADB4;
    outline-offset: 2px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.filter-input:focus {
    outline: none;
    border-color: #00ADB4;
    box-shadow: 0 0 0 3px rgba(0, 173, 180, 0.1);
}

@media (max-width: 480px) {
    .nav-item:focus,
    .sidebar-new-patient-btn:focus,
    .mobile-new-patient-btn:focus {
        outline-width: 2px !important;
        outline-offset: 1px !important;
    }
}

/* =================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ================================================================= */
@media (hover: none) and (pointer: coarse) {
    /* Touch device specific styles */
    .table-row:hover {
        background: white;
        transform: none;
    }
    
    .nav-item:hover {
        background: transparent;
    }
    
    .stat-card:hover {
        transform: none;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar-patient-item:hover {
        background: white;
        border-color: #e5e7eb;
        transform: none;
    }
    
    /* Enhance active states for touch */
    .table-row:active {
        background: #f8fafc !important;
        transform: scale(0.98) !important;
    }
    
    .nav-item:active {
        background: #f0f9ff !important;
    }
    
    .stat-card:active {
        transform: scale(0.98) !important;
    }
}

/* =================================================================
   CUSTOM SCROLLBARS (WEBKIT BROWSERS)
   ================================================================= */
@media (max-width: 480px) {
    .main-content::-webkit-scrollbar {
        width: 6px;
    }
    
    .main-content::-webkit-scrollbar-track {
        background: #f1f5f9;
    }
    
    .main-content::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 3px;
    }
    
    .main-content::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }
}

/* =================================================================
   SAFE AREA INSETS FOR NOTCHED DEVICES
   ================================================================= */
@supports (padding-top: env(safe-area-inset-top)) {
    @media (max-width: 480px) {
        .header {
            padding-top: calc(16px + env(safe-area-inset-top)) !important;
        }
        
        .sidebar {
            padding-bottom: env(safe-area-inset-bottom) !important;
        }
        
        .main-content {
            height: calc(100vh - 70px - env(safe-area-inset-bottom)) !important;
        }
    }
}

/* =================================================================
   LOADING STATES
   ================================================================= */
.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f4f6;
    border-top: 3px solid #00ADB4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Button loading states */
.btn.loading {
    position: relative;
    color: transparent !important;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@media (max-width: 480px) {
    .loading-spinner {
        width: 24px !important;
        height: 24px !important;
        border-width: 2px !important;
    }
    
    .btn.loading::after {
        width: 14px !important;
        height: 14px !important;
    }
}

/* =================================================================
   UTILITY CLASSES
   ================================================================= */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.no-scroll {
    overflow: hidden;
}

@media (max-width: 480px) {
    .mobile-hidden {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
}

@media (min-width: 481px) {
    .desktop-hidden {
        display: none !important;
    }
    
    .desktop-only {
        display: block !important;
    }
    
    .mobile-only {
        display: none !important;
    }
}

/* =================================================================
   RECORDING VIEW MOBILE LAYOUT FIXES
   ================================================================= */

   @media (max-width: 480px) {
    /* =================================================================
       RECORDING VIEW CONTAINER - COMPLETE MOBILE OVERHAUL
       ================================================================= */
    
    /* When in recording mode, ensure main content is completely hidden */
    .app-container.recording-mode .main-content {
        display: none !important;
    }
    
    /* Recording view should take full screen */
    .recording-view-container {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: #f8fafc !important;
        z-index: 9999 !important;
        flex-direction: column !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* =================================================================
       MOBILE RECORDING HEADER - TOP SECTION
       ================================================================= */
    .recording-header {
        position: sticky !important;
        top: 0 !important;
        width: 100% !important;
        background: white !important;
        border-bottom: 1px solid #e1e5e9 !important;
        padding: 16px 20px !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
        z-index: 1000 !important;
        flex-shrink: 0 !important;
        order: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }
    
    /* Mobile back button - positioned on the left */
    .mobile-back-button {
        background: #f3f4f6 !important;
        color: #374151 !important;
        padding: 8px 12px !important;
        border-radius: 6px !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        cursor: pointer !important;
        border: 1px solid #d1d5db !important;
        transition: all 0.2s ease !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        flex-shrink: 0 !important;
        min-height: 36px !important;
    }
    
    .mobile-back-button:active {
        background: #e5e7eb !important;
        transform: scale(0.95) !important;
    }
    
    /* Center the session info */
    .recording-header .session-info {
        flex: 1 !important;
        text-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 12px !important;
    }
    
    .recording-header .session-info h2 {
        font-size: 18px !important;
        margin: 0 0 4px 0 !important;
        color: #1f2937 !important;
        text-align: center !important;
    }
    
    .session-details {
        font-size: 14px !important;
        color: #6b7280 !important;
        text-align: center !important;
        margin: 0 !important;
        line-height: 1.3 !important;
    }
    
    /* Spacer to balance the layout */
    .mobile-header-spacer {
        width: 60px !important;
        flex-shrink: 0 !important;
    }
    
    /* =================================================================
       MOBILE PATIENT SIDEBAR - HORIZONTAL STRIP
       ================================================================= */
    .recording-sidebar {
        width: 100% !important;
        height: 100px !important;
        background: white !important;
        border-bottom: 1px solid #e1e5e9 !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        flex-shrink: 0 !important;
        order: 2 !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 8px !important;
        gap: 12px !important;
        position: relative !important;
        z-index: 999 !important;
    }
    
    /* Hide desktop sidebar header on mobile */
    .recording-sidebar .sidebar-header {
        display: none !important;
    }
    
    /* Mobile sidebar new patient button */
    .recording-sidebar .sidebar-new-patient-container {
        flex-shrink: 0 !important;
        padding: 0 !important;
        border: none !important;
        margin-right: 8px !important;
    }
    
    .recording-sidebar .sidebar-new-patient-oblong {
        width: 80px !important;
        height: 80px !important;
        border-radius: 12px !important;
        background: #00ADB4 !important;
        color: white !important;
        border: none !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        font-size: 10px !important;
        font-weight: 600 !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        box-shadow: 0 2px 4px rgba(0, 173, 180, 0.2) !important;
    }
    
    .recording-sidebar .sidebar-new-patient-oblong:active {
        background: #008B94 !important;
        transform: scale(0.95) !important;
    }
    
    .recording-sidebar .new-patient-plus-icon {
        width: 24px !important;
        height: 24px !important;
        background: rgba(255, 255, 255, 0.2) !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 16px !important;
        font-weight: bold !important;
    }
    
    .recording-sidebar .new-patient-button-text {
        font-size: 9px !important;
        font-weight: 600 !important;
        text-align: center !important;
        line-height: 1 !important;
    }
    
    /* Mobile horizontal patient list */
    .sidebar-schedule-list {
        flex: 1 !important;
        display: flex !important;
        flex-direction: row !important;
        gap: 12px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 0 !important;
        height: 84px !important;
        align-items: center !important;
    }
    
    /* Mobile patient cards - compact horizontal layout */
    .sidebar-patient-item {
        flex-shrink: 0 !important;
        width: 80px !important;
        height: 80px !important;
        background: white !important;
        border: 2px solid #e5e7eb !important;
        border-radius: 12px !important;
        padding: 8px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
        margin: 0 !important;
        position: relative !important;
    }
    
    .sidebar-patient-item:active {
        background: #e0f7fa !important;
        border-color: #00ADB4 !important;
        transform: scale(0.95) !important;
    }
    
    .sidebar-patient-item.active {
        background: #e0f7fa !important;
        border-color: #00ADB4 !important;
        border-width: 3px !important;
        box-shadow: 0 2px 8px rgba(0, 173, 180, 0.3) !important;
    }
    
    .sidebar-patient-info {
        width: 100% !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
    }
    
    .sidebar-patient-name {
        font-size: 9px !important;
        font-weight: 600 !important;
        color: #1f2937 !important;
        margin-bottom: 2px !important;
        line-height: 1.1 !important;
        max-width: 64px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        text-align: center !important;
    }
    
    .sidebar-patient-contact {
        font-size: 8px !important;
        color: #6b7280 !important;
        line-height: 1 !important;
        margin: 0 0 4px 0 !important;
        max-width: 64px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        text-align: center !important;
    }
    
    .sidebar-patient-status {
        margin-top: 2px !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }
    
    .sidebar-status-badge {
        padding: 2px 4px !important;
        font-size: 7px !important;
        border-radius: 6px !important;
        max-width: 60px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        text-align: center !important;
        line-height: 1.2 !important;
    }
    
    /* Scrollbar for horizontal patient list */
    .sidebar-schedule-list::-webkit-scrollbar {
        height: 4px !important;
    }
    
    .sidebar-schedule-list::-webkit-scrollbar-track {
        background: #f1f1f1 !important;
        border-radius: 2px !important;
    }
    
    .sidebar-schedule-list::-webkit-scrollbar-thumb {
        background: #c1c1c1 !important;
        border-radius: 2px !important;
    }
    
    .sidebar-schedule-list::-webkit-scrollbar-thumb:hover {
        background: #a8a8a8 !important;
    }
    
    /* =================================================================
       MOBILE RECORDING CONTENT - MAIN AREA
       ================================================================= */
    .recording-main-content {
        flex: 1 !important;
        order: 3 !important;
        overflow-y: auto !important;
        background: #f8fafc !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
    }
    
    .recording-content {
        padding: 20px !important;
        height: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        background: #f8fafc !important;
    }
    
    /* =================================================================
       MOBILE RECORDING INTERFACE ADJUSTMENTS - FIXED LAYOUT ISSUES
       ================================================================= */
    .main-content-area {
        margin: 0 !important;
        padding: 16px !important;
        border-radius: 8px !important;
        min-height: auto !important;
        height: auto !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    }
    
    .recording-interface {
        padding: 20px 16px !important;
        min-height: auto !important;
        height: auto !important;
    }
    
    /* FIXED: Recording status area with proper spacing */
    .recording-status-area {
        height: 140px !important; /* Increased height to prevent overlap */
        margin-bottom: 20px !important;
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
    
    /* FIXED: Session timer positioning */
    .session-timer {
        font-size: 48px !important;
        position: relative !important;
        top: 0 !important;
        left: auto !important;
        right: auto !important;
        margin: 0 0 8px 0 !important;
        text-align: center !important;
        width: 100% !important;
        line-height: 1 !important;
    }
    
    /* FIXED: Recording status text positioning */
    .recording-status-text {
        font-size: 16px !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        margin: 0 0 20px 0 !important;
        text-align: center !important;
        width: 100% !important;
        height: auto !important;
        line-height: 1.3 !important;
    }
    
    /* Recording controls */
    .recording-controls-center {
        margin-top: 0 !important;
    }
    
    .primary-record-btn {
        width: 60px !important;
        height: 60px !important;
    }
    
    .end-session-btn {
        min-width: 140px !important;
        padding: 8px 16px !important;
        font-size: 14px !important;
        min-height: 36px !important;
    }
    
    .audio-visualizer {
        height: 40px !important;
        margin: 16px 0 !important;
    }
    
    .visualizer-bars {
        height: 30px !important;
        width: 80px !important;
    }
    
    .session-controls {
        height: 40px !important;
        margin-top: 16px !important;
    }
    
    /* =================================================================
       MOBILE EMPTY STATE FOR PATIENT LIST
       ================================================================= */
    .sidebar-empty {
        flex-shrink: 0 !important;
        width: 80px !important;
        height: 80px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #f9fafb !important;
        border: 2px dashed #d1d5db !important;
        border-radius: 12px !important;
        color: #6b7280 !important;
    }
    
    .sidebar-empty .empty-text {
        font-size: 10px !important;
        text-align: center !important;
        line-height: 1.2 !important;
        padding: 4px !important;
    }
    
    /* =================================================================
       HIDE DESKTOP MAIN SIDEBAR ON MOBILE RECORDING VIEW
       ================================================================= */
    .app-container.recording-mode .sidebar {
        display: none !important;
    }
}

/* Very small mobile adjustments */
@media (max-width: 360px) {
    .recording-sidebar {
        height: 90px !important;
    }
    
    .sidebar-new-patient-oblong,
    .sidebar-patient-item {
        width: 70px !important;
        height: 70px !important;
    }
    
    .sidebar-patient-name {
        font-size: 8px !important;
        max-width: 56px !important;
    }
    
    .sidebar-patient-contact {
        font-size: 7px !important;
    }
    
    .new-patient-plus-icon {
        width: 20px !important;
        height: 20px !important;
        font-size: 14px !important;
    }
    
    .new-patient-button-text {
        font-size: 8px !important;
    }
    
    .recording-header {
        padding: 12px 16px !important;
    }
    
    .recording-content {
        padding: 16px !important;
    }
    
    .mobile-back-button {
        padding: 6px 10px !important;
        font-size: 13px !important;
    }
    
    .session-timer {
        font-size: 42px !important;
    }
    
    .recording-status-text {
        font-size: 14px !important;
    }
}

/* MOBILE BACK BUTTON POSITION FIX - Add to responsive.css */

@media (max-width: 480px) {
    /* =================================================================
       MOBILE BACK BUTTON - MOVED TO TOP LEFT CORNER
       ================================================================= */
    
    /* Position back button as floating element at the bottom of content area */
    .mobile-back-button {
        position: fixed !important;
        bottom: 20px !important; /* Much lower - inside the patient info area */
        left: 16px !important;
        z-index: 10000 !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(8px) !important;
        color: #374151 !important;
        padding: 10px 14px !important;
        border-radius: 24px !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        cursor: pointer !important;
        border: 1px solid rgba(209, 213, 219, 0.8) !important;
        transition: all 0.2s ease !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
        min-height: 44px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15) !important;
        /* Ensure it's above everything */
        pointer-events: auto !important;
        /* Better thumb accessibility */
        min-width: 44px !important;
    }
    
    .mobile-back-button:active {
        background: rgba(229, 231, 235, 0.95) !important;
        transform: scale(0.95) !important;
    }
    
    /* =================================================================
       MOBILE RECORDING HEADER - REMOVE BACK BUTTON SPACE
       ================================================================= */
    
    /* Simplify recording header - just centered content */
    .recording-header {
        position: sticky !important;
        top: 0 !important;
        width: 100% !important;
        background: white !important;
        border-bottom: 1px solid #e1e5e9 !important;
        padding: 16px 20px !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
        z-index: 1000 !important;
        flex-shrink: 0 !important;
        order: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important; /* Center everything */
    }
    
    /* Remove the spacer elements since back button is floating */
    .mobile-header-spacer {
        display: none !important;
    }
    
    /* Center the session info without competing elements */
    .recording-header .session-info {
        flex: none !important;
        text-align: center !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        width: 100% !important;
    }
    
    .recording-header .session-info h2 {
        font-size: 18px !important;
        margin: 0 0 4px 0 !important;
        color: #1f2937 !important;
        text-align: center !important;
    }
    
    .session-details {
        font-size: 14px !important;
        color: #6b7280 !important;
        text-align: center !important;
        margin: 0 !important;
        line-height: 1.3 !important;
    }
    
    /* =================================================================
       MOBILE RECORDING CONTENT - MORE VERTICAL SPACE
       ================================================================= */
    
    /* Ensure recording interface has more space */
    .recording-interface {
        padding: 16px !important; /* Reduced top padding since back button is floating */
        min-height: auto !important;
        height: auto !important;
    }
    
    /* Optimize recording status area for more space */
    .recording-status-area {
        height: 120px !important; /* Slightly reduced */
        margin-bottom: 16px !important; /* Reduced margin */
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }
    
    /* Optimize session timer */
    .session-timer {
        font-size: 52px !important; /* Slightly larger since we have more space */
        position: relative !important;
        top: 0 !important;
        left: auto !important;
        right: auto !important;
        margin: 0 0 6px 0 !important;
        text-align: center !important;
        width: 100% !important;
        line-height: 1 !important;
    }
    
    /* Optimize recording status text */
    .recording-status-text {
        font-size: 16px !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        margin: 0 0 16px 0 !important;
        text-align: center !important;
        width: 100% !important;
        height: auto !important;
        line-height: 1.3 !important;
    }
    
    /* =================================================================
       MOBILE PATIENT SIDEBAR - ENSURE IT'S BELOW FLOATING BACK BUTTON
       ================================================================= */
    
    /* Make sure patient sidebar doesn't interfere with floating back button */
    .recording-sidebar {
        width: 100% !important;
        height: 100px !important;
        background: white !important;
        border-bottom: 1px solid #e1e5e9 !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        flex-shrink: 0 !important;
        order: 2 !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 8px !important;
        gap: 12px !important;
        position: relative !important;
        z-index: 999 !important; /* Below the floating back button */
        margin-top: 0 !important;
    }
    
    /* =================================================================
       HANDLE SAFE AREA FOR NOTCHED DEVICES
       ================================================================= */
    
    /* Adjust for devices with notches */
    @supports (padding-bottom: env(safe-area-inset-bottom)) {
        .mobile-back-button {
            bottom: calc(20px + env(safe-area-inset-bottom)) !important;
        }
    }
}

/* Very small mobile adjustments */
@media (max-width: 360px) {
    .mobile-back-button {
        padding: 8px 12px !important;
        font-size: 13px !important;
        min-height: 40px !important;
        bottom: 15px !important; /* Inside patient info area */
        left: 12px !important;
        border-radius: 20px !important;
    }
    
    .recording-header {
        padding: 12px 16px !important;
    }
    
    .session-timer {
        font-size: 48px !important;
    }
    
    .recording-status-text {
        font-size: 15px !important;
    }
}

/* Landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-back-button {
        bottom: 15px !important; /* Inside patient info area */
        left: 12px !important;
        padding: 8px 12px !important;
        font-size: 13px !important;
        min-height: 40px !important;
    }
    
    .recording-header {
        padding: 10px 16px !important;
    }
    
    .recording-status-area {
        height: 100px !important;
        margin-bottom: 12px !important;
    }
    
    .session-timer {
        font-size: 42px !important;
        margin-bottom: 4px !important;
    }
    
    .recording-status-text {
        font-size: 14px !important;
        margin-bottom: 12px !important;
    }
}

/* =================================================================
   MOBILE COLLAPSIBLE STATS OVERRIDE (Add this to your mobile section)
   ================================================================= */

   @media (max-width: 480px) {
    /* IMPORTANT: Override existing mobile stats styles to support collapsible */
    
    /* Ensure stats section appears on mobile */
    .stats-section {
        display: block !important;
        margin: 14px 18px 16px !important;
        background: white !important;
        border: 1px solid #e1e5e9 !important;
        border-radius: 12px !important;
        overflow: hidden !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Mobile toggle header */
    .stats-toggle {
        display: flex !important;
        padding: 14px 18px !important;
        cursor: pointer !important;
        justify-content: space-between !important;
        align-items: center !important;
        background: #f8fafc !important;
        transition: background-color 0.2s ease !important;
        user-select: none !important;
        border: none !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .stats-toggle:active {
        background: #e0f7fa !important;
    }
    
    .stats-toggle-content {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
    }
    
    .stats-toggle-icon,
    .stats-toggle-arrow {
        width: 20px !important;
        height: 20px !important;
        color: #6b7280 !important;
    }
    
    .stats-toggle-text {
        font-size: 14px !important;
        font-weight: 600 !important;
        color: #374151 !important;
    }
    
    .stats-toggle-arrow {
        transition: transform 0.3s ease !important;
    }
    
    .stats-section.expanded .stats-toggle-arrow {
        transform: rotate(180deg) !important;
    }
    
    /* CRITICAL: Override all existing mobile stats-container styles */
    .stats-section .stats-container {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        padding: 14px 18px !important;
        background: white !important;
        transition: all 0.3s ease !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        z-index: auto !important;
        order: unset !important;
    }
    
    /* Hide when collapsed */
    .stats-section.collapsed .stats-container {
        display: none !important;
        padding: 0 !important;
        height: 0 !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
    
    /* Show when expanded */
    .stats-section.expanded .stats-container {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        opacity: 1 !important;
        visibility: visible !important;
        height: auto !important;
    }
    
    /* Mobile stat cards - override existing styles */
    .stats-section .stat-card {
        background: white !important;
        padding: 14px 10px !important;
        border-radius: 12px !important;
        text-align: center !important;
        min-height: 80px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
        border: 1px solid #f3f4f6 !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        margin: 0 !important;
        width: auto !important;
        height: auto !important;
        transform: none !important;
        transition: transform 0.2s ease !important;
    }
    
    .stats-section .stat-card:active {
        transform: scale(0.98) !important;
    }
    
    .stats-section .stat-number {
        font-size: 24px !important;
        font-weight: 700 !important;
        color: #00ADB4 !important;
        margin-bottom: 4px !important;
        line-height: 1 !important;
    }
    
    .stats-section .stat-label {
        font-size: 11px !important;
        color: #6b7280 !important;
        font-weight: 500 !important;
        line-height: 1.2 !important;
    }
}

@media (max-width: 480px) {
    /* Fix height expansion issue */
    .stats-section {
        display: block !important;
        position: relative !important;
        margin: 14px 18px 16px !important;
        background: white !important;
        border: 1px solid #e1e5e9 !important;
        border-radius: 12px !important;
        overflow: visible !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
        /* Remove fixed heights that prevent expansion */
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        transition: none !important;
    }
    
    /* When collapsed - minimal height */
    .stats-section.collapsed {
        height: auto !important;
        min-height: 50px !important; /* Just for the toggle button */
    }
    
    /* When expanded - grow with content */
    .stats-section.expanded {
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
    }
    
    .stats-toggle {
        display: flex !important;
        height: 50px !important; /* Fixed height for toggle */
        padding: 14px 18px !important;
        box-sizing: border-box !important;
        background: #f8fafc !important;
        flex-shrink: 0 !important;
    }
    
    /* Let container grow naturally */
    .stats-section .stats-container {
        position: relative !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* Force collapsed state */
    .stats-section.collapsed .stats-container {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        height: 0 !important;
        padding: 0 !important;
    }
    
    /* Force expanded state */  
    .stats-section.expanded .stats-container {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        padding: 14px 18px !important;
        opacity: 1 !important;
        visibility: visible !important;
        height: auto !important;
    }
}

/* =================================================================
   END OF RESPONSIVE.CSS
   ================================================================= */