/* ==========================================
   SPACE PARK CONFINS - MOBILE STYLES
   Otimizações responsivas para todos os dispositivos
   ========================================== */

/* ==========================================
   VARIÁVEIS MOBILE
   ========================================== */
:root {
    --mobile-padding: 1rem;
    --mobile-margin: 0.75rem;
    --mobile-gap: 0.75rem;
    --touch-target-min: 48px;
    --mobile-font-base: 16px;
    --mobile-font-small: 14px;
    --mobile-font-large: 18px;
}

/* ==========================================
   MOBILE GLOBAL (até 767px)
   ========================================== */
@media (max-width: 767px) {

    /* Container */
    .container {
        padding-left: var(--mobile-padding) !important;
        padding-right: var(--mobile-padding) !important;
    }

    /* Typography */
    h1 {
        font-size: 1.75rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    h3 {
        font-size: 1.25rem !important;
    }

    h4 {
        font-size: 1.1rem !important;
    }

    h5 {
        font-size: 1rem !important;
    }

    p,
    li,
    span {
        font-size: var(--mobile-font-base) !important;
        line-height: 1.6 !important;
    }

    small,
    .text-sm {
        font-size: var(--mobile-font-small) !important;
    }

    /* Buttons */
    .btn {
        min-height: var(--touch-target-min);
        padding: 0.75rem 1.5rem !important;
        font-size: var(--mobile-font-base) !important;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .btn-sm {
        min-height: 40px;
        padding: 0.5rem 1rem !important;
    }

    /* Forms */
    input,
    textarea,
    select {
        font-size: var(--mobile-font-base) !important;
        min-height: var(--touch-target-min);
        padding: 0.75rem !important;
    }

    label {
        font-size: var(--mobile-font-base) !important;
        margin-bottom: 0.5rem !important;
    }

    /* Cards */
    .card {
        margin-bottom: var(--mobile-margin);
        padding: 1rem !important;
    }

    /* Grids - Force single column */
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    [class*="col-"] {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    /* Tables */
    table {
        font-size: var(--mobile-font-small);
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table td,
    table th {
        padding: 0.5rem !important;
        white-space: nowrap;
    }

    /* Modals */
    .modal-content {
        margin: 1rem;
        max-width: calc(100vw - 2rem) !important;
        max-height: 95vh !important;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem !important;
    }

    /* Spacing */
    .mb-4,
    .my-4 {
        margin-bottom: 1.5rem !important;
    }

    .mt-4,
    .my-4 {
        margin-top: 1.5rem !important;
    }

    .p-4 {
        padding: 1rem !important;
    }
}

/* ==========================================
   HEADER / NAVIGATION - INDEX.HTML
   ========================================== */
@media (max-width: 991px) {

    header,
    .header {
        padding: 0.5rem 0 !important;
    }

    .navbar {
        padding: 0.5rem 1rem !important;
        flex-wrap: wrap;
        position: relative;
    }

    .navbar-brand img,
    .logo img {
        max-height: 50px !important;
        height: 50px !important;
    }

    /* Hide logo text on mobile */
    .logo span {
        display: none;
    }

    /* Hide nav links on mobile */
    .nav-links {
        display: none !important;
    }

    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex !important;
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--color-gray-900);
        padding: 0.5rem;
        min-width: 48px;
        min-height: 48px;
        align-items: center;
        justify-content: center;
    }

    /* NAVBAR BUTTONS - FIX STACKING ISSUE */
    .navbar>div[style*="display: flex"],
    .desktop-buttons {
        display: none !important;
    }

    /* Mobile Menu visible on mobile */
    .mobile-menu {
        display: none;
        /* Controlled by JS */
    }
}

/* Small mobile specific */
@media (max-width: 575px) {

    .header .container,
    header .container {
        padding: 0 0.75rem !important;
    }

    .navbar {
        padding: 0.25rem 0.5rem !important;
    }

    .logo img {
        height: 40px !important;
        max-height: 40px !important;
    }
}

/* Desktop - hide mobile menu */
@media (min-width: 992px) {

    .mobile-menu,
    .mobile-menu-toggle {
        display: none !important;
    }
}

/* ==========================================
   HERO SECTION
   ========================================== */
@media (max-width: 767px) {
    .hero {
        min-height: auto !important;
        padding: 100px 0 120px 0 !important;
        /* 100px top for fixed header, 120px bottom for calculator overlap */
    }

    .hero-content {
        padding: 0 1rem !important;
        max-width: 100% !important;
    }

    .hero h1 {
        font-size: 1.5rem !important;
        margin-bottom: 1rem !important;
        line-height: 1.3 !important;
        word-wrap: break-word !important;
    }

    .hero h1 br {
        display: none;
        /* Remove line breaks on mobile */
    }

    .hero-subtitle,
    .hero p {
        font-size: 0.95rem !important;
        margin-bottom: 1.5rem !important;
        line-height: 1.5 !important;
        padding: 0 0.5rem;
    }

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

    .hero .btn,
    .hero-buttons .btn {
        width: 100% !important;
        margin-bottom: 0 !important;
    }

    /* Hero Stats - 3 columns on mobile */
    .hero-stats {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem !important;
        margin-top: 1.5rem !important;
        padding-top: 1.5rem !important;
    }

    .hero-stats .stat-value {
        font-size: 1.25rem !important;
    }

    .hero-stats .stat-label {
        font-size: 0.7rem !important;
    }
}

/* Extra small devices */
@media (max-width: 375px) {
    .hero h1 {
        font-size: 1.3rem !important;
    }

    .hero-subtitle,
    .hero p {
        font-size: 0.875rem !important;
    }

    .hero-stats .stat-value {
        font-size: 1rem !important;
    }
}

/* ==========================================
   CARDS GRID
   ========================================== */
@media (max-width: 767px) {
    [style*="display: grid"] {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .space-card,
    .feature-card,
    .price-card {
        max-width: 100% !important;
    }
}

/* ==========================================
   WIZARD / STEPS
   ========================================== */
@media (max-width: 767px) {
    .wizard-steps {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }

    .wizard-step {
        min-width: 80px;
        font-size: 0.75rem !important;
    }

    .wizard-step-number {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.875rem !important;
    }

    .wizard-content {
        padding: 1rem !important;
    }

    /* Resumo de valores mobile */
    .price-summary {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
        padding: 1rem;
        z-index: 100;
    }
}

/* ==========================================
   DASHBOARD SIDEBAR
   ========================================== */
@media (max-width: 991px) {
    .dashboard-layout {
        flex-direction: column !important;
    }

    .sidebar {
        width: 100% !important;
        position: fixed !important;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 1rem !important;
    }

    .mobile-menu-toggle {
        position: fixed;
        bottom: 1rem;
        right: 1rem;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--color-primary, #1a5490);
        color: white;
        border: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        z-index: 998;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
    }
}

/* ==========================================
   DASHBOARD STATS / CARDS
   ========================================== */
@media (max-width: 767px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .stat-card {
        padding: 1rem !important;
    }

    .stat-card h3 {
        font-size: 1.25rem !important;
    }

    .stat-card .stat-value {
        font-size: 1.5rem !important;
    }
}

/* ==========================================
   FORMS
   ========================================== */
@media (max-width: 767px) {
    .form-row {
        flex-direction: column;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-control {
        width: 100% !important;
    }

    /* Checkbox and Radio */
    .form-check {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }

    .form-check-label {
        font-size: var(--mobile-font-base);
    }
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */
@media (max-width: 767px) {
    .mobile-hidden {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    .mobile-full-width {
        width: 100% !important;
    }

    .mobile-text-center {
        text-align: center !important;
    }

    .mobile-no-padding {
        padding: 0 !important;
    }

    .mobile-no-margin {
        margin: 0 !important;
    }
}

/* Desktop - Hide mobile-only elements */
@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }

    .mobile-menu-toggle {
        display: none !important;
    }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */
@media (max-width: 767px) {

    /* Increase touch targets */
    a,
    button,
    [role="button"] {
        min-height: var(--touch-target-min);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Better focus indicators */
    *:focus-visible {
        outline: 3px solid var(--color-primary, #1a5490);
        outline-offset: 2px;
    }
}

/* ==========================================
   LANDSCAPE ORIENTATION
   ========================================== */
@media (max-width: 767px) and (orientation: landscape) {
    .hero {
        min-height: 50vh !important;
    }

    .modal-content {
        max-height: 90vh !important;
        overflow-y: auto;
    }
}

/* ==========================================
   PRINT
   ========================================== */
@media print {

    .sidebar,
    .mobile-menu-toggle,
    .btn,
    .navbar {
        display: none !important;
    }

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