/* ==================== RESPONSIVE DESIGN ==================== */

*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
video { max-width: 100%; height: auto; display: block; }

/* ==================== TABLES ==================== */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: -ms-autohiding-scrollbar;
    border-radius: 8px;
}

.table {
    min-width: 600px;
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

/* ==================== CONTAINERS ==================== */
.container,
.container-fluid {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* ==================== CARD GRID ==================== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 0 1rem;
}

/* ==================== FORMS ==================== */
.form-container {
    max-width: 100%;
    padding: 1.5rem 1rem;
    margin: 1rem auto;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    font-size: 16px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-height: 44px;
}

.form-textarea { min-height: 120px; resize: vertical; }

/* ==================== BUTTONS ==================== */
.btn {
    min-height: 44px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    touch-action: manipulation;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-primary { background-color: #4a6baf; color: white; }
.btn-primary:hover, .btn-primary:active { background-color: #3a5a9f; }
.btn-danger { background-color: #dc3545; color: white; }
.btn-secondary { background-color: #6c757d; color: white; }

/* ==================== DASHBOARD ==================== */
.dashboard {
    display: flex;
    flex-direction: row;
    min-height: calc(100vh - 200px);
}

/* ==================== LARGE TABLETS AND BELOW ==================== */
@media (max-width: 992px) {
    .dashboard { flex-direction: column; }

    .sidebar {
        width: 100%;
        padding: 0.5rem 0;
        position: sticky;
        top: 60px;
        z-index: 100;
        overflow-x: auto;
        background: #4a6baf;
    }

    .sidebar-menu {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 0 0.5rem;
        gap: 0.25rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        list-style: none;
        margin: 0;
    }

    .sidebar-menu::-webkit-scrollbar { display: none; }

    .sidebar-item { flex: 0 0 auto; margin-bottom: 0; }

    .sidebar-link {
        padding: 0.6rem 1rem;
        white-space: nowrap;
        border-radius: 20px;
        font-size: 0.85rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        color: white;
        text-decoration: none;
    }

    .sidebar-link.active { background-color: rgba(255, 255, 255, 0.25); }

    .dashboard-content { padding: 1rem; width: 100%; }

    .nav-menu {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 60px);
        background: linear-gradient(135deg, #4a6baf, #2c4b8a);
        flex-direction: column;
        padding: 1.5rem;
        transition: left 0.3s ease;
        overflow-y: auto;
        z-index: 999;
        gap: 0;
    }

    .nav-menu.active { left: 0; }

    /* === HAMBURGER FORCED VISIBLE — NO CSS RULE CAN OVERRIDE === */
    .hamburger {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        flex-direction: column;
        cursor: pointer;
        padding: 0.5rem;
        background: transparent;
        border: none;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        z-index: 1001;
    }

    .hamburger span {
        width: 25px;
        height: 3px;
        background-color: #ffffff !important;
        margin: 2px 0;
        transition: all 0.3s ease;
        display: block !important;
        border-radius: 2px;
    }

    .hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .hamburger.active span:nth-child(2) { opacity: 0; }
    .hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(7px, -6px); }

    .hero h1 { font-size: 2.2rem; }
    .hero p { font-size: 1rem; }
    .section-title h2 { font-size: 2rem; }
    .footer-container { grid-template-columns: 1fr; }
}

/* ==================== TABLETS AND MOBILE ==================== */
@media (max-width: 768px) {
    html { font-size: 15px; }
    .nav-container { padding: 0 1rem; }

    .nav-link {
        width: 100%;
        padding: 1rem;
        display: block;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        text-align: left;
    }

    .nav-actions {
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        gap: 1rem;
    }

    .auth-buttons { width: 100%; flex-direction: column; gap: 0.5rem; }

    .login-btn,
    .register-btn {
        width: 100%;
        text-align: center;
        padding: 0.75rem;
        display: block;
    }

    .language-switcher { width: 100%; justify-content: center; }

    .dropdown { width: 100%; }
    .dropdown > .nav-link { display: none; }

    .dropdown-content {
        position: static;
        display: block;
        width: 100%;
        box-shadow: none;
        background-color: transparent;
    }

    .dropdown-content a {
        color: white;
        padding: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-left: 2rem;
        font-size: 0.9rem;
        display: block;
        text-decoration: none;
    }

    .dropdown-content a:hover { background-color: rgba(255, 255, 255, 0.1); }

    .hero { padding: 3rem 1rem; min-height: 50vh; }
    .hero h1 { font-size: 1.8rem; }
    .hero p { font-size: 1rem; }

    .hero-buttons { flex-direction: column; gap: 0.75rem; }
    .hero-buttons .btn { width: 100%; }

    .section-title h2 { font-size: 1.6rem; }

    .card-grid { grid-template-columns: 1fr; gap: 1rem; padding: 0 0.5rem; }

    .form-container {
        padding: 1rem;
        border-radius: 0;
        margin: 0;
        box-shadow: none;
    }

    .form-title { font-size: 1.3rem; }

    .table th, .table td { padding: 0.5rem; font-size: 0.85rem; }

    .footer-container { grid-template-columns: 1fr; gap: 1.5rem; padding: 0 1rem; }
    .footer { padding: 2rem 0 1rem; }

    .whatsapp-float {
        width: 50px;
        height: 50px;
        font-size: 24px;
        bottom: 15px;
        right: 15px;
    }

    .dashboard-content { padding: 0.75rem; }
    .dashboard-content h2 { font-size: 1.3rem; }
}

/* ==================== SMALL MOBILE ==================== */
@media (max-width: 576px) {
    html { font-size: 14px; }
    .nav-logo img { height: 35px; }

    .hero h1 { font-size: 1.4rem; }
    .hero p { font-size: 0.9rem; }

    .section { padding: 2rem 0.75rem; }
    .section-title h2 { font-size: 1.3rem; }

    .card { border-radius: 8px; }
    .card-content { padding: 1rem; }
    .card-title { font-size: 1.1rem; }
    .card-text { font-size: 0.9rem; }

    .form-container { padding: 1rem 0.75rem; }
    .form-title { font-size: 1.2rem; }

    .btn { padding: 0.6rem 1rem; font-size: 0.9rem; }
    .table th, .table td { padding: 0.4rem; font-size: 0.8rem; }

    .whatsapp-float {
        width: 45px;
        height: 45px;
        font-size: 20px;
        bottom: 10px;
        right: 10px;
    }

    .modal-content {
        padding: 1rem;
        margin: 0.5rem;
        max-height: 95vh;
        border-radius: 8px;
    }

    .sidebar-link { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
    .dashboard-content { padding: 0.5rem; }
}

/* ==================== LANDSCAPE PHONE ==================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero { min-height: auto; padding: 2rem 1rem; }
    .nav-menu { max-height: calc(100vh - 60px); overflow-y: auto; }
    .sidebar { position: relative; top: auto; }
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .no-print,
    .navbar,
    .footer,
    .whatsapp-float,
    .sidebar,
    .hamburger,
    .btn,
    .nav-actions,
    .language-switcher { display: none !important; }

    .dashboard { display: block; }

    .dashboard-content {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .table-container {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }

    body { background: white !important; font-size: 12px; color: #000; }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }

    .table { min-width: auto; font-size: 11px; }
    .table th, .table td { padding: 4px 6px; }

    @page { margin: 0.5cm; size: landscape; }

    a { text-decoration: none; color: #000; }
    img { max-width: 100%; page-break-inside: avoid; }
}

/* ==================== UTILITY ==================== */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-3 { margin-top: 1rem; }
.mb-3 { margin-bottom: 1rem; }

/* ==================== TOUCH FRIENDLY ==================== */
@media (hover: none) and (pointer: coarse) {
    .btn { min-height: 48px; padding: 0.75rem 1.25rem; }
    .nav-link { min-height: 44px; }
    .sidebar-link { min-height: 44px; }
    .form-input, .form-select, .form-textarea { min-height: 48px; }
    .hamburger { min-width: 48px; min-height: 48px; display: flex !important; }
}