/* ===== RESPONSIVE.CSS - CSS สำหรับ Responsive Design ===== */
/* Media Queries สำหรับอุปกรณ์ต่างๆ */

/* ===== TABLET (768px และลง) ===== */
@media (max-width: 768px) {
    /* Container */
    .container {
        padding: 10px;
    }

    /* Header */
    .header h1 {
        font-size: 2rem;
    }

    .header .subtitle {
        font-size: 1rem;
    }

    .period-info {
        font-size: 0.9rem;
        padding: 12px 20px;
    }

    /* Navigation */
    .nav-tabs {
        flex-direction: column;
        align-items: center;
    }

    .nav-tab {
        width: 100%;
        max-width: 300px;
        text-align: center;
    }

    /* Form Container */
    .form-container {
        padding: 20px;
    }

    /* Personal Info Grid */
    .personal-info {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Step Indicator */
    .step-indicator {
        flex-direction: column;
        gap: 15px;
    }

    .step-line {
        width: 3px;
        height: 50px;
        transform: rotate(90deg);
    }

    /* GI Grid */
    .gi-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .gi-card {
        padding: 15px;
    }

    /* Navigation Buttons */
    .navigation-buttons {
        flex-direction: column;
        gap: 15px;
    }

    .btn {
        width: 100%;
        justify-content: center;
        padding: 12px 30px;
    }

    /* Selected GI Items */
    .selected-gi-item {
        padding: 20px;
    }

    .selected-gi-details {
        flex-direction: column;
        gap: 10px;
    }

    /* Dashboard */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .chart-container {
        padding: 20px;
    }

    /* File Upload */
    .file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .file-info {
        width: 100%;
    }

    .remove-file {
        align-self: flex-end;
    }
}

/* ===== MOBILE (480px และลง) ===== */
@media (max-width: 480px) {
    /* Header */
    .header {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .header .subtitle {
        font-size: 0.95rem;
    }

    /* Form */
    .form-container {
        padding: 15px;
    }

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

    .form-group label {
        font-size: 1rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px;
        font-size: 0.95rem;
    }

    /* Search */
    .search-input {
        padding: 12px 40px 12px 15px;
        font-size: 1rem;
    }

    .search-icon {
        right: 15px;
        font-size: 1.1rem;
    }

    /* Filter Options */
    .filter-options {
        gap: 8px;
    }

    .filter-btn {
        padding: 6px 15px;
        font-size: 0.9rem;
    }

    /* GI Cards */
    .gi-card {
        padding: 12px;
    }

    .gi-name {
        font-size: 1.1rem;
    }

    .gi-number {
        padding: 4px 10px;
        font-size: 0.8rem;
    }

    /* Selected Count */
    .selected-count {
        padding: 10px 20px;
        font-size: 0.95rem;
    }

    /* Buttons */
    .btn {
        padding: 10px 25px;
        font-size: 1rem;
    }

    /* Opinion Textarea */
    .opinion-textarea {
        min-height: 120px;
        padding: 12px;
        font-size: 0.95rem;
    }

    /* File Upload */
    .file-upload-label {
        padding: 10px 15px;
        font-size: 0.95rem;
    }

    /* Dashboard */
    .dashboard {
        padding: 20px;
    }

    .stat-number {
        font-size: 2rem;
    }

    .stat-label {
        font-size: 1rem;
    }

    /* Loading */
    .loading {
        min-width: 300px !important;
        padding: 30px 25px !important;
    }

    .loading p {
        font-size: 1rem;
    }

    /* Alert */
    .alert {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    /* Consent Modal Mobile Improvements */
    .modal-content {
        max-width: 95vw !important;
        margin: 10px !important;
    }
    
    .modal-body {
        padding: 20px !important;
        max-height: 85vh !important;
    }
    
    #consentCheckbox {
        width: 22px !important;
        height: 22px !important;
        min-width: 22px !important;
        min-height: 22px !important;
    }
    
    #consentAccept,
    #consentDecline {
        padding: 16px 30px !important;
        font-size: 1rem !important;
        min-width: 120px !important;
    }
}

/* ===== SMALL MOBILE (360px และลง) ===== */
@media (max-width: 360px) {
    .container {
        padding: 5px;
    }

    .header {
        padding: 15px;
        margin-bottom: 20px;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    .form-container {
        padding: 12px;
    }

    .nav-tab {
        padding: 12px 20px;
        font-size: 1rem;
    }

    .gi-card {
        padding: 10px;
    }

    .selected-gi-item {
        padding: 15px;
    }

    .btn {
        padding: 8px 20px;
        font-size: 0.95rem;
    }

    .loading {
        min-width: 280px !important;
        padding: 25px 20px !important;
    }
}

/* ===== LANDSCAPE ORIENTATION ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        padding: 20px;
        margin-bottom: 20px;
    }

    .header h1 {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }

    .header .subtitle {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    .form-container {
        padding: 25px;
    }

    .step-indicator {
        margin-bottom: 25px;
    }

    .navigation-buttons {
        margin-top: 25px;
    }
}

/* ===== HIGH DPI / RETINA DISPLAYS ===== */
@media (-webkit-min-device-pixel-ratio: 2), 
       (min-resolution: 192dpi) {
    .gi-card,
    .btn,
    .form-container {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* ===== TOUCH DEVICES ===== */
@media (hover: none) and (pointer: coarse) {
    .btn:hover,
    .nav-tab:hover,
    .gi-card:hover,
    .filter-btn:hover,
    .file-upload-label:hover {
        transform: none;
    }

    .btn:active,
    .nav-tab:active,
    .gi-card:active {
        transform: scale(0.98);
    }
    
    /* Consent Modal Touch Improvements */
    #consentCheckbox {
        width: 24px !important;
        height: 24px !important;
        min-width: 24px !important;
        min-height: 24px !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(231, 76, 60, 0.3);
    }
    
    /* Consent Modal Label Touch Area */
    #consentModal label {
        -webkit-tap-highlight-color: rgba(231, 76, 60, 0.1);
        touch-action: manipulation;
    }
    
    /* Consent Buttons Touch Improvements */
    #consentAccept,
    #consentDecline {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background: white;
    }

    .nav-tabs,
    .loading,
    .loading-overlay,
    .navigation-buttons {
        display: none !important;
    }

    .container {
        max-width: none;
        padding: 0;
    }

    .header,
    .form-container,
    .dashboard {
        background: white;
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .gi-card {
        break-inside: avoid;
    }
}