/**
 * responsive.css - Global Responsive Rules for Portal STIA
 * Injected automatically via shared-components.js
 * 3 breakpoints: 1200px (desktop small), 768px (tablet/mobile), 480px (mobile small)
 */

/* ============================================
   iOS Zoom Prevention - inputs must be 16px+
   ============================================ */
@media screen and (max-width: 768px) {
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* ============================================
   BREAKPOINT: 1200px - Desktop small
   ============================================ */
@media (max-width: 1200px) {
    .page-container {
        padding: 1.5rem;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .quick-actions-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }

    .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
    }
}

/* ============================================
   BREAKPOINT: 768px - Tablet / Mobile principal
   ============================================ */
@media (max-width: 768px) {
    /* Page containers */
    .page-container {
        padding: 1rem;
    }

    .main-container {
        padding: 1rem !important;
    }

    /* Page header */
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .page-title h1 {
        font-size: 1.5rem !important;
    }

    .page-title p {
        font-size: 0.875rem;
    }

    /* Glass panels */
    .glass-panel {
        padding: 1.25rem !important;
        border-radius: 0.75rem !important;
    }

    .filter-glass-panel {
        padding: 1rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }

    /* Form grids - stack on mobile */
    .form-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Override grid-column span for mobile */
    .form-grid > [style*="grid-column: span"] {
        grid-column: span 1 !important;
    }

    /* Tabs */
    .tabs-container {
        display: flex !important;
        flex-wrap: wrap !important;
        width: 100%;
    }

    .tab-btn,
    .tab {
        flex: 1;
        justify-content: center;
        padding: 0.625rem 0.75rem !important;
        font-size: 0.85rem;
        min-width: 0;
    }

    .tab-btn i,
    .tab i {
        display: none;
    }

    /* Glass tables - horizontal scroll */
    .glass-table-container {
        border-radius: 0.5rem !important;
    }

    .glass-table {
        font-size: 0.8rem !important;
        min-width: 600px;
    }

    .glass-table th {
        padding: 0.75rem 0.5rem !important;
        font-size: 0.7rem !important;
    }

    .glass-table td {
        padding: 0.625rem 0.5rem !important;
    }

    /* Modals */
    .modal-content {
        width: 95% !important;
        max-width: none !important;
        border-radius: 1rem !important;
        max-height: 95vh !important;
    }

    .modal-header {
        padding: 1rem 1.25rem !important;
    }

    .modal-body {
        padding: 1rem 1.25rem !important;
    }

    .modal-footer {
        padding: 1rem 1.25rem !important;
    }

    /* Buttons */
    .btn-premium {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    /* Welcome banner */
    .welcome-banner {
        padding: 2rem !important;
        margin-bottom: 2rem !important;
    }

    .welcome-banner h1 {
        font-size: 1.75rem !important;
    }

    .welcome-banner p {
        font-size: 1rem !important;
    }

    /* Stats row */
    .stats-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    /* Cards grid */
    .cards-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .quick-actions-grid {
        grid-template-columns: 1fr !important;
    }

    /* Actions section - stack buttons */
    .actions-section,
    [style*="display: flex"][style*="justify-content: flex-end"] {
        flex-wrap: wrap;
    }

    /* Search sections - stack */
    .search-section > div[style*="display: flex"] {
        flex-direction: column !important;
    }

    /* Flow diagrams - ensure scroll */
    .flow-diagram {
        padding: 1rem !important;
        overflow-x: auto !important;
    }

    .flow-diagram pre {
        font-size: 11px !important;
    }

    /* Info boxes */
    .info-box {
        padding: 1rem !important;
    }
}

/* ============================================
   BREAKPOINT: 480px - Mobile small
   ============================================ */
@media (max-width: 480px) {
    .page-container {
        padding: 0.75rem;
    }

    .main-container {
        padding: 0.75rem !important;
    }

    .page-title h1 {
        font-size: 1.25rem !important;
    }

    /* Glass panels */
    .glass-panel {
        padding: 1rem !important;
    }

    /* Welcome banner */
    .welcome-banner {
        padding: 1.5rem !important;
        border-radius: 1rem !important;
    }

    .welcome-banner h1 {
        font-size: 1.5rem !important;
    }

    .welcome-banner p {
        font-size: 0.875rem !important;
    }

    /* Stats row - single column */
    .stats-row {
        grid-template-columns: 1fr !important;
    }

    .stat-card {
        padding: 1rem !important;
    }

    .stat-number {
        font-size: 1.5rem !important;
    }

    /* Tabs - even more compact */
    .tab-btn,
    .tab {
        padding: 0.5rem 0.625rem !important;
        font-size: 0.8rem !important;
    }

    /* Modals - full width */
    .modal {
        padding: 10px !important;
    }

    .modal-content {
        width: 100% !important;
        border-radius: 0.75rem !important;
    }

    .modal-header h2,
    .modal-header h3 {
        font-size: 1rem !important;
    }

    /* Buttons stacking */
    .btn-premium {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }

    /* Section headers */
    .section-header h2 {
        font-size: 1.25rem !important;
    }

    /* Page header buttons - wrap */
    .page-header > div[style*="display: flex"][style*="gap"] {
        width: 100%;
    }

    .page-header > div[style*="display: flex"][style*="gap"] .btn-premium {
        flex: 1;
        justify-content: center;
    }

    /* Action cards */
    .action-card {
        padding: 1rem !important;
    }

    .stia-card {
        padding: 1.25rem !important;
    }
}
