/* ========================================
   Mobile-Specific Styles
   Hamburger Menu & Responsive Fixes
   ======================================== */

/* Hamburger Button */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0 1rem 0 0;
    z-index: 1001;
}

.hamburger-btn span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Hamburger Animation - Default State */
.hamburger-btn span:nth-child(1) {
    transform: translateY(0) rotate(0deg);
}

.hamburger-btn span:nth-child(2) {
    opacity: 1;
}

.hamburger-btn span:nth-child(3) {
    transform: translateY(0) rotate(0deg);
}

/* Hamburger Animation - Open State */
.hamburger-btn.open span:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
}

.hamburger-btn.open span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.open span:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
}

/* Mobile Menu */
.nav-links.mobile-open {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    gap: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 999;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-links.mobile-open a {
    width: 100%;
    padding: 1rem 1.5rem;
    text-align: right;
    border-radius: 0;
    font-size: 1rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
}

.nav-links.mobile-open a::after {
    content: attr(data-icon);
    font-size: 1.3rem;
    order: -1;
}

/* Responsive Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .hamburger-btn {
        display: flex;
    }

    .nav-links {
        display: none;
        position: relative;
    }

    .navbar .container {
        gap: 0;
    }
}

/* Responsive Mobile (480px - 768px) */
@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
    }

    .navbar {
        padding: 0.5rem 0;
    }

    .navbar .container {
        padding: 0 0.75rem;
        gap: 0.5rem;
    }

    .logo-image {
        height: 45px;
    }

    .logo-text {
        display: none;
    }

    .nav-links {
        display: none;
    }

    .nav-links.mobile-open {
        display: flex;
    }

    /* Touch-friendly buttons */
    .btn,
    button {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }

    /* Responsive text */
    h1, .page-title {
        font-size: 1.5rem !important;
        margin-bottom: 1.5rem;
    }

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

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

    /* Forms */
    .form-grid,
    .quantity-input-grid,
    .results-grid,
    .item-info-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .form-group select,
    .form-group input,
    .form-select,
    .form-input {
        width: 100% !important;
        padding: 14px 12px !important;
        font-size: 16px !important; /* Prevent zoom on iOS */
    }

    /* Containers */
    .calculator-container,
    .app-container {
        padding: 1.5rem 0.75rem;
        margin: 1rem auto;
        max-width: 100%;
    }

    /* Cards */
    .section-card,
    .glass-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
        border-radius: 12px;
    }

    .section-header {
        margin-bottom: 1.5rem;
        padding-bottom: 1rem;
    }

    .section-header h3 {
        font-size: 1rem;
    }

    /* Tables */
    #items-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
    }

    table {
        width: 100%;
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
    }

    /* Info Cards */
    .info-card {
        padding: 1rem;
        gap: 10px;
    }

    .info-icon {
        font-size: 28px;
    }

    .info-value {
        font-size: 1.5rem;
    }

    /* Modals */
    .modal-content {
        width: 95% !important;
        margin: 20% auto !important;
        padding: 1.5rem !important;
        max-height: 90vh;
        border-radius: 12px;
    }

    /* Search */
    .search-container,
    .search-box-wrapper {
        margin-bottom: 1.5rem;
    }

    .search-box {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 8px;
    }

    .search-input {
        font-size: 16px !important;
    }

    /* Results */
    #resultsContent {
        overflow-x: auto;
    }

    .results-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Cost Calculator */
    .cost-inputs-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .cost-input {
        width: 100% !important;
    }

    .modifiers-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    /* Crew Table */
    .crew-table {
        font-size: 0.85rem;
    }

    .crew-table th,
    .crew-table td {
        padding: 0.75rem 0.5rem;
    }

    /* Filters */
    .search-bar,
    .filter-row,
    .filters .filter-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .search-bar select,
    .search-bar input,
    .filter-row select,
    .filter-row input,
    .filter-row button {
        width: 100%;
        margin-right: 0;
    }
}

/* Extra Small (< 480px) */
@media (max-width: 480px) {
    .hamburger-btn {
        margin: 0 0.5rem 0 0;
        width: 28px;
        height: 22px;
    }

    .hamburger-btn span {
        height: 2px;
    }

    .navbar .container {
        padding: 0 0.5rem;
    }

    .logo-image {
        height: 40px;
    }

    .theme-toggle,
    .lang-toggle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        margin: 0;
    }

    .calculator-container {
        padding: 1rem 0.5rem;
    }

    .section-card,
    .glass-card {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }

    .section-header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }

    .section-header h3 {
        font-size: 0.95rem;
    }

    h1, .page-title {
        font-size: 1.25rem !important;
    }

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

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

    .form-grid,
    .quantity-input-grid,
    .modifiers-grid {
        gap: 0.75rem;
    }

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

    .form-select,
    .form-input {
        padding: 12px 10px !important;
        font-size: 16px !important;
    }

    .btn {
        padding: 11px 14px;
        font-size: 0.9rem;
    }

    .info-card {
        padding: 0.75rem;
        gap: 8px;
    }

    .info-icon {
        font-size: 24px;
    }

    .info-label {
        font-size: 0.85rem;
    }

    .info-value {
        font-size: 1.25rem;
    }

    table {
        font-size: 0.75rem;
    }

    th, td {
        padding: 0.5rem;
    }

    .modal-content {
        width: 98% !important;
        margin: 30% auto 20% !important;
        padding: 1rem !important;
    }

    /* Cost summary small screens */
    .summary-grid {
        gap: 0.5rem;
    }

    .summary-line {
        font-size: 0.9rem;
    }

    /* Hide less important elements on very small screens */
    .share-buttons-horizontal {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* Extra extra small (< 360px) */
@media (max-width: 360px) {
    .hamburger-btn {
        width: 26px;
        height: 20px;
    }

    .logo-image {
        height: 35px;
    }

    .calculator-container {
        padding: 0.75rem 0.25rem;
    }

    .section-card {
        padding: 1rem;
    }

    .form-select,
    .form-input {
        padding: 10px 8px !important;
        font-size: 14px !important;
    }

    h1, .page-title {
        font-size: 1.1rem !important;
    }

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

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

/* Landscape Mode Adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar {
        padding: 0.3rem 0;
    }

    .navbar .container {
        gap: 0.3rem;
    }

    .hamburger-btn {
        margin: 0 0.3rem 0 0;
    }

    .section-card {
        margin-bottom: 0.75rem;
        padding: 1rem;
    }

    .form-grid {
        gap: 0.75rem;
    }
}

/* Improve readability in dark mode */
@media (prefers-color-scheme: dark) {
    .hamburger-btn span {
        background-color: #e0e0e0;
    }

    .nav-links.mobile-open {
        background: #1a1a1a;
        border-color: #333;
    }
}

/* Accessibility: Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .hamburger-btn span,
    .nav-links.mobile-open,
    .hamburger-btn.open span:nth-child(1),
    .hamburger-btn.open span:nth-child(3) {
        transition: none;
        animation: none;
    }
}

/* Print Styles */
@media print {
    .hamburger-btn,
    .navbar,
    .nav-links,
    .theme-toggle,
    .lang-toggle {
        display: none !important;
    }
}

.mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 98;
    display: none;
}

.mobile-sidebar-backdrop.show {
    display: block;
}
