/* Jasiri Mobile-First Enhancements */

/* === IMPROVED SPACING & TYPOGRAPHY === */
@media (max-width: 768px) {
    /* Base typography improvements */
    body {
        font-size: 16px;
        line-height: 1.6;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    h1 {
        font-size: 1.875rem;
        line-height: 1.25;
        letter-spacing: -0.02em;
    }
    
    h2 {
        font-size: 1.5rem;
        line-height: 1.3;
        letter-spacing: -0.01em;
    }
    
    h3 {
        font-size: 1.25rem;
        line-height: 1.4;
    }
    
    /* Improved container spacing */
    .container,
    .max-w-7xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Section spacing */
    section {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
}

/* === ENHANCED GRID LAYOUTS === */
@media (max-width: 768px) {
    /* Single column grids */
    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4,
    .md\:grid-cols-2,
    .md\:grid-cols-3,
    .lg\:grid-cols-3,
    .lg\:grid-cols-4 {
        grid-template-columns: 1fr !important;
    }
    
    /* Two column for stats */
    .stats-grid,
    .grid.stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }
}

/* === IMPROVED NAVIGATION === */
@media (max-width: 768px) {
    nav {
        position: sticky;
        top: 0;
        z-index: 50;
        backdrop-filter: blur(12px);
        background: rgba(255, 255, 255, 0.95);
    }
    
    .dark nav {
        background: rgba(17, 24, 39, 0.95);
    }
    
    /* Mobile menu improvements */
    .mobile-menu {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        z-index: 40;
        overflow-y: auto;
        padding: 1.5rem;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .mobile-menu.open {
        transform: translateX(0);
    }
    
    .mobile-menu a {
        display: block;
        padding: 1rem;
        font-size: 1.125rem;
        border-radius: 12px;
        margin-bottom: 0.5rem;
        min-height: 56px;
        display: flex;
        align-items: center;
    }
}

/* === CARD ENHANCEMENTS === */
@media (max-width: 768px) {
    .card,
    .glass-card {
        border-radius: 16px;
        padding: 1.25rem;
        margin-bottom: 1rem;
    }
    
    /* Improved card shadows */
    .card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .card:active {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }
}

/* === FORM ENHANCEMENTS === */
@media (max-width: 768px) {
    /* Better form groups */
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    /* Improved input styling */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    input[type="url"],
    select,
    textarea {
        width: 100%;
        padding: 0.9375rem 1rem;
        font-size: 16px;
        border: 2px solid #e5e7eb;
        border-radius: 12px;
        min-height: 48px;
        transition: all 0.2s ease;
        -webkit-appearance: none;
        appearance: none;
    }
    
    input:focus,
    select:focus,
    textarea:focus {
        border-color: #54e6b6;
        outline: none;
        box-shadow: 0 0 0 3px rgba(84, 230, 182, 0.1);
    }
    
    /* File inputs */
    input[type="file"] {
        padding: 0.75rem;
    }
    
    /* Checkboxes and radios */
    input[type="checkbox"],
    input[type="radio"] {
        width: 20px;
        height: 20px;
        min-height: auto;
        cursor: pointer;
    }
    
    /* Labels */
    label {
        font-size: 0.9375rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
        display: block;
        color: #374151;
    }
    
    .dark label {
        color: #d1d5db;
    }
}

/* === BUTTON ENHANCEMENTS === */
@media (max-width: 768px) {
    /* Primary buttons */
    .btn,
    button:not(.unstyled) {
        min-height: 48px;
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
        font-weight: 600;
        border-radius: 12px;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .btn:active,
    button:active:not(.unstyled) {
        transform: scale(0.96);
    }
    
    /* Full width buttons */
    .btn-block,
    .w-full.btn {
        width: 100%;
    }
    
    /* Button groups */
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .btn-group .btn {
        width: 100%;
    }
}

/* === TABLE IMPROVEMENTS === */
@media (max-width: 768px) {
    /* Responsive tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 100%;
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
    }
    
    /* Card-style tables */
    .table-card {
        display: block;
    }
    
    .table-card thead {
        display: none;
    }
    
    .table-card tbody {
        display: block;
    }
    
    .table-card tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: 1rem;
    }
    
    .table-card td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border: none;
    }
    
    .table-card td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 1rem;
    }
}

/* === IMAGE OPTIMIZATIONS === */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
        border-radius: 12px;
    }
    
    /* Avatar improvements */
    .avatar {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        object-fit: cover;
    }
    
    .avatar-lg {
        width: 80px;
        height: 80px;
    }
}

/* === NOTIFICATION IMPROVEMENTS === */
@media (max-width: 768px) {
    .notification,
    .toast,
    .alert {
        position: fixed;
        top: 1rem;
        left: 1rem;
        right: 1rem;
        z-index: 9999;
        border-radius: 12px;
        padding: 1rem 1.25rem;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
        animation: slideDown 0.3s ease-out;
    }
    
    @keyframes slideDown {
        from {
            transform: translateY(-100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

/* === BOTTOM SHEET IMPROVEMENTS === */
@media (max-width: 768px) {
    .bottom-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-radius: 24px 24px 0 0;
        padding: 1.5rem;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
        transform: translateY(100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .bottom-sheet.open {
        transform: translateY(0);
    }
    
    .bottom-sheet::before {
        content: '';
        position: absolute;
        top: 0.75rem;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: #d1d5db;
        border-radius: 2px;
    }
}

/* === SKELETON LOADING === */
@media (max-width: 768px) {
    .skeleton {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
        background-size: 200% 100%;
        animation: shimmer 1.5s infinite;
        border-radius: 8px;
    }
    
    @keyframes shimmer {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }
    
    .skeleton-text {
        height: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .skeleton-avatar {
        width: 48px;
        height: 48px;
        border-radius: 50%;
    }
}

/* === SCROLL IMPROVEMENTS === */
@media (max-width: 768px) {
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
    }
    
    /* Hide scrollbar but keep functionality */
    .hide-scrollbar {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
    
    .hide-scrollbar::-webkit-scrollbar {
        display: none;
    }
    
    /* Custom scrollbar for containers */
    .custom-scrollbar::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }
    
    .custom-scrollbar::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .custom-scrollbar::-webkit-scrollbar-thumb {
        background: #d1d5db;
        border-radius: 2px;
    }
}

/* === ACCESSIBILITY IMPROVEMENTS === */
@media (max-width: 768px) {
    /* Focus visible improvements */
    *:focus-visible {
        outline: 2px solid #54e6b6;
        outline-offset: 2px;
    }
    
    /* Skip to content link */
    .skip-to-content {
        position: absolute;
        top: -100px;
        left: 1rem;
        background: #54e6b6;
        color: #000;
        padding: 0.75rem 1.5rem;
        border-radius: 8px;
        font-weight: 600;
        z-index: 10000;
    }
    
    .skip-to-content:focus {
        top: 1rem;
    }
}

/* === DARK MODE IMPROVEMENTS === */
@media (max-width: 768px) {
    .dark {
        color-scheme: dark;
    }
    
    .dark body {
        background: #111827;
        color: #f3f4f6;
    }
    
    .dark .card,
    .dark .glass-card {
        background: rgba(30, 41, 59, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .dark input,
    .dark select,
    .dark textarea {
        background: #1e293b;
        border-color: #374151;
        color: #f3f4f6;
    }
}

/* === UTILITY CLASSES === */
@media (max-width: 768px) {
    .mobile-only {
        display: block !important;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .mobile-hidden {
        display: none !important;
    }
    
    .mobile-text-center {
        text-align: center;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-p-4 {
        padding: 1rem !important;
    }
    
    .mobile-mb-4 {
        margin-bottom: 1rem !important;
    }
}
