/*
 * Shamoody Responsive Styles
 * Mobile-first approach with breakpoints for tablet and desktop
 * Bottom navigation for mobile, sidebar navigation for desktop
 */

/* Breakpoints */
/* Mobile: < 768px */
/* Tablet: 768px - 1024px */
/* Desktop: >= 1024px */

/* ===========================
   MOBILE STYLES (Default)
   =========================== */

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1.5px solid var(--ocean-border);
    box-shadow: 0 -4px 20px rgba(91, 166, 196, 0.08);
    padding: var(--space-2) var(--space-4);
    display: flex;
    justify-content: space-around;
    align-items: center;
    /* Safe area for iOS devices */
    padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom));
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2);
    text-decoration: none;
    color: var(--ocean-text-disabled);
    transition: all 0.3s ease;
    min-width: 64px;
    border-radius: var(--radius-md);
}

.bottom-nav-item:hover {
    background: var(--ocean-surface-tint);
    color: var(--ocean-primary);
}

.bottom-nav-item.active {
    color: var(--ocean-primary);
}

.bottom-nav-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.bottom-nav-item.active .bottom-nav-icon {
    background: var(--ocean-gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(107, 191, 206, 0.3);
}

.bottom-nav-item:not(.active) .bottom-nav-icon {
    background: rgba(168, 218, 220, 0.15);
}

.bottom-nav-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

/* Main Content Padding for Bottom Nav */
.main-content-mobile {
    padding-bottom: 100px; /* Space for bottom nav + safe area */
}

/* Hide Sidebar on Mobile */
@media (max-width: 767px) {
    .mud-drawer {
        display: none !important;
    }

    .bottom-nav {
        display: flex;
    }

    /* Adjust main content when sidebar is hidden */
    .mud-main-content {
        margin-left: 0 !important;
        padding-bottom: 100px !important;
    }

    /* Mobile header adjustments */
    .mud-appbar .mud-icon-button {
        display: none; /* Hide hamburger menu on mobile */
    }

    /* Stack cards vertically */
    .mud-grid-item {
        flex-basis: 100% !important;
        max-width: 100% !important;
    }

    /* Mobile card adjustments */
    .ocean-card {
        margin-bottom: var(--space-4);
    }

    /* Ensure buttons are touch-friendly */
    .mud-button,
    .ocean-btn-primary,
    .ocean-btn-secondary {
        min-height: 48px;
        min-width: 48px;
    }

    /* Mobile typography */
    h1, .mud-typography-h1 {
        font-size: 2rem !important;
    }

    h2, .mud-typography-h2 {
        font-size: 1.75rem !important;
    }

    h4, .mud-typography-h4 {
        font-size: 1.5rem !important;
    }

    /* Mobile padding/margins */
    .mud-container {
        padding-left: var(--space-4) !important;
        padding-right: var(--space-4) !important;
    }
}

/* ===========================
   TABLET STYLES
   =========================== */
@media (min-width: 768px) and (max-width: 1023px) {
    /* Show sidebar on tablet */
    .mud-drawer {
        display: block !important;
    }

    /* Hide bottom nav on tablet */
    .bottom-nav {
        display: none;
    }

    /* Adjust main content */
    .mud-main-content {
        padding-bottom: var(--space-4) !important;
    }

    /* 2-column grid for stats cards */
    .stats-grid .mud-grid-item {
        flex-basis: 50% !important;
        max-width: 50% !important;
    }
}

/* ===========================
   DESKTOP STYLES
   =========================== */
@media (min-width: 1024px) {
    /* Show sidebar on desktop */
    .mud-drawer {
        display: block !important;
    }

    /* Hide bottom nav on desktop */
    .bottom-nav {
        display: none;
    }

    /* Remove bottom padding from main content */
    .mud-main-content {
        padding-bottom: var(--space-4) !important;
    }

    /* Desktop drawer width */
    .mud-drawer {
        width: 260px !important;
    }

    /* 4-column grid for stats cards */
    .stats-grid .mud-grid-item {
        flex-basis: 25% !important;
        max-width: 25% !important;
    }

    /* Larger containers on desktop */
    .mud-container-maxwidth-xl {
        max-width: 1400px !important;
    }
}

/* ===========================
   HEADER RESPONSIVE
   =========================== */
.ocean-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    background: var(--ocean-surface);
    border-bottom: 1.5px solid var(--ocean-border);
}

.ocean-header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.ocean-header-title {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--ocean-gradient-tertiary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.ocean-header-subtitle {
    font-size: 0.75rem;
    color: var(--ocean-text-secondary);
    margin: 0;
}

.ocean-header-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.ocean-header-email {
    font-size: 0.875rem;
    color: var(--ocean-text-secondary);
    display: none; /* Hidden on mobile */
}

@media (min-width: 768px) {
    .ocean-header-email {
        display: block;
    }

    .ocean-header-title {
        font-size: 2rem;
    }
}

/* ===========================
   GRID RESPONSIVE UTILITIES
   =========================== */
.grid-responsive {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: repeat(1, 1fr);
}

@media (min-width: 640px) {
    .grid-responsive {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid-responsive.grid-4-col {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===========================
   CARD RESPONSIVE
   =========================== */
@media (max-width: 767px) {
    .ocean-card {
        border-radius: var(--radius-lg);
        padding: var(--space-4);
    }

    .ocean-card-rounded {
        border-radius: var(--radius-xl);
    }
}

@media (min-width: 768px) {
    .ocean-card {
        padding: var(--space-6);
    }
}

/* ===========================
   DASHBOARD SPECIFIC
   =========================== */
.dashboard-container {
    padding: var(--space-4);
    max-width: 1400px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .dashboard-container {
        padding: var(--space-6);
    }
}

@media (min-width: 1024px) {
    .dashboard-container {
        padding: var(--space-8);
    }
}

/* Quick Actions Grid */
.quick-actions-grid {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(1, 1fr);
    margin-bottom: var(--space-6);
}

@media (min-width: 640px) {
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: var(--space-6);
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===========================
   FORM RESPONSIVE
   =========================== */
.form-grid {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: repeat(1, 1fr);
}

@media (min-width: 768px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-grid.three-col {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ===========================
   UTILITY RESPONSIVE CLASSES
   =========================== */
.hide-mobile {
    display: none;
}

@media (min-width: 768px) {
    .hide-mobile {
        display: block;
    }
}

.hide-desktop {
    display: block;
}

@media (min-width: 768px) {
    .hide-desktop {
        display: none;
    }
}

.show-tablet-up {
    display: none;
}

@media (min-width: 768px) {
    .show-tablet-up {
        display: block;
    }
}

/* ===========================
   SCROLL BEHAVIOR
   =========================== */
html {
    scroll-behavior: smooth;
}

/* Prevent horizontal scroll on mobile */
body {
    overflow-x: hidden;
}

/* ===========================
   TOUCH OPTIMIZATION
   =========================== */
@media (hover: none) and (pointer: coarse) {
    /* Touch device optimizations */
    .ocean-btn-primary,
    .ocean-btn-secondary,
    .quick-action-btn,
    .bottom-nav-item {
        -webkit-tap-highlight-color: rgba(107, 191, 206, 0.2);
    }

    /* Larger touch targets */
    .mud-button,
    .mud-icon-button {
        min-height: 48px;
        min-width: 48px;
    }
}

/* ===========================
   PRINT STYLES
   =========================== */
@media print {
    .bottom-nav,
    .mud-drawer,
    .mud-appbar,
    .ocean-header {
        display: none !important;
    }

    .mud-main-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .ocean-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* ===========================
   LANDSCAPE MOBILE
   =========================== */
@media (max-width: 767px) and (orientation: landscape) {
    .bottom-nav {
        padding: var(--space-1) var(--space-4);
    }

    .bottom-nav-label {
        display: none;
    }

    .bottom-nav-icon {
        width: 36px;
        height: 36px;
    }
}
