/* ==================== MODERN MOBILE FIXES & ENHANCEMENTS ==================== */
/* Premium mobile-first styling to override basic Bootstrap/legacy styles */

:root {
    --mobile-spacing: 16px;
    --mobile-card-radius: 16px;
    --mobile-font-scale: 1.1;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.07);
}

/* ==================== BASE TYPOGRAPHY ==================== */
@media (max-width: 768px) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
    }

    h1,
    .h1 {
        font-size: 28px !important;
        letter-spacing: -0.5px;
        line-height: 1.2;
    }

    h2,
    .h2 {
        font-size: 24px !important;
        letter-spacing: -0.3px;
    }

    h3,
    .h3 {
        font-size: 20px !important;
    }

    p {
        font-size: 16px !important;
        line-height: 1.6;
        color: var(--text-secondary);
    }

    /* Improve contrast for small screens */
    .text-muted {
        color: #6b7280 !important;
    }
}

/* ==================== PREMIUM CARD STYLING ==================== */
@media (max-width: 768px) {

    .card,
    .project-card,
    .stat-card,
    .dashboard-card {
        border: none !important;
        border-radius: var(--mobile-card-radius) !important;
        background: #ffffff !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
        margin-bottom: 20px !important;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        overflow: hidden;
    }

    /* Active state for touch feedback */
    .card:active,
    .project-card:active {
        transform: scale(0.98);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03) !important;
    }

    .card-header {
        background: transparent !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.03) !important;
        padding: 15px 20px !important;
    }

    .card-body {
        padding: 20px !important;
    }
}

/* ==================== BUTTONS & TOUCH TARGETS ==================== */
@media (max-width: 768px) {
    .btn {
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 12px !important;
        font-weight: 600 !important;
        font-size: 15px !important;
        box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
        letter-spacing: 0.3px;
    }

    .btn-primary {
        background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
        border: none !important;
    }

    /* Floating Action Button for major actions */
    .mobile-fab {
        position: fixed;
        bottom: 24px;
        right: 24px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--primary-color);
        box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        z-index: 1000;
    }
}

/* ==================== NAVIGATION BAR ==================== */
@media (max-width: 991px) {

    .navbar,
    .modern-navbar {
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
        position: sticky !important;
        top: 0;
        z-index: 1040;
        padding: 12px 16px !important;
    }

    .navbar-brand {
        font-weight: 800 !important;
        background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        font-size: 22px !important;
    }
}

/* ==================== SIDEBAR MODERNIZATION ==================== */
@media (max-width: 991px) {
    .mobile-sidebar {
        background: #ffffff !important;
        color: var(--text-primary) !important;
        box-shadow: 5px 0 30px rgba(0, 0, 0, 0.1) !important;
        width: 85% !important;
        max-width: 320px;
    }

    /* Sidebar Header */
    .sidebar-header {
        border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
        padding: 24px !important;
        background: #fdfdfd;
    }

    .sidebar-brand .brand-text {
        color: #111827 !important;
        font-size: 22px !important;
    }

    .sidebar-close {
        color: #9ca3af !important;
        background: #f3f4f6;
        border-radius: 50%;
    }

    /* Sidebar Links */
    .sidebar-nav-item {
        color: #4b5563 !important;
        padding: 14px 24px !important;
        font-weight: 500;
        border-radius: 0 24px 24px 0;
        margin-right: 16px;
    }

    .sidebar-nav-item i {
        color: #9ca3af;
        transition: color 0.2s;
    }

    .sidebar-nav-item.active {
        background: rgba(124, 58, 237, 0.08) !important;
        color: var(--primary-color) !important;
    }

    .sidebar-nav-item.active i {
        color: var(--primary-color);
    }

    /* User Profile in Sidebar */
    .sidebar-user {
        border-top: 1px solid rgba(0, 0, 0, 0.05) !important;
        padding: 20px 24px !important;
        background: #f9fafb;
        margin-top: auto;
    }

    .sidebar-user-name {
        color: #111827 !important;
        font-size: 15px !important;
    }

    .sidebar-user-email {
        color: #6b7280 !important;
    }
}

/* ==================== FORM ELEMENTS ==================== */
@media (max-width: 768px) {
    .form-control {
        background-color: #f9fafb !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 12px !important;
        padding: 14px 16px !important;
        /* Larger touch target */
        font-size: 16px !important;
        /* Prevents zoom on focus */
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .form-control:focus {
        background-color: #fff !important;
        border-color: var(--primary-color) !important;
        box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1) !important;
    }
}

/* ==================== PROJECT LISTINGS ==================== */
@media (max-width: 768px) {
    .project-image-container {
        border-radius: 12px;
        overflow: hidden;
        margin-bottom: 16px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .badge {
        padding: 6px 12px !important;
        border-radius: 20px !important;
        font-weight: 600;
    }
}

/* ==================== HOME PAGE STATS MOBILE ==================== */
@media (max-width: 768px) {
    section.stats {
        padding: 60px 0 !important;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
        /* Force single column */
        gap: 20px !important;
        padding: 0 20px;
    }

    .stat-item {
        padding: 24px !important;
        margin-bottom: 0 !important;
    }
}