/* ============================================================
   SILENT BID BUDDY — Mobile & Responsive Styles
   Enhanced breakpoints for various screen sizes
   ============================================================ */

/* ============================================================
   SMALL DEVICES (320px - 639px)
   ============================================================ */

@media (max-width: 639px) {
    :root {
        --font-size-base: 14px;
        --font-size-lg: 16px;
        --font-size-xl: 20px;
        --font-size-2xl: 24px;
        --spacing-md: 12px;
        --spacing-lg: 16px;
        --spacing-xl: 20px;
    }

    .container {
        padding: var(--spacing-md);
    }

    .auth-splash {
        padding: var(--spacing-lg);
        border-radius: var(--radius-md);
    }

    .splash-header h1 {
        font-size: var(--font-size-xl);
    }

    .item-title {
        font-size: var(--font-size-lg);
    }

    .current-bid-amount {
        font-size: 36px;
    }

    .countdown-timer {
        font-size: var(--font-size-xl);
    }

    .btn-large {
        padding: var(--spacing-md);
    }

    .modal-content {
        padding: var(--spacing-md);
    }

    .auth-page .container {
        padding: var(--spacing-sm);
    }

    .app-header {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .app-header h1 {
        font-size: var(--font-size-base);
    }

    .how-steps {
        grid-template-columns: 1fr;
    }

    .item-image {
        max-height: 250px;
        object-fit: cover;
    }

    .image-placeholder {
        height: 200px;
    }

    .landing-nav {
        position: absolute;
        align-items: flex-start;
        padding: 0.8rem 1rem;
    }

    .landing-brand span {
        max-width: 120px;
        line-height: 1.05;
    }

    .landing-nav-links {
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 0.42rem 0.7rem;
        max-width: 210px;
        font-size: 0.78rem;
    }

    .landing-nav-links a[href="#experience"],
    .landing-nav-links a[href="#tools"],
    .landing-nav-links a[href="items.php"] {
        display: none;
    }

    .landing-hero {
        display: block;
        min-height: 96vh;
        padding: 6.4rem 1rem 1rem;
    }

    .landing-hero-bg {
        background:
            linear-gradient(180deg, rgba(8, 16, 31, 0.58) 0%, rgba(8, 16, 31, 0.9) 72%),
            url("../images/items/generated/napa-vineyard-weekend.png") center / cover no-repeat;
    }

    .landing-hero-content {
        width: 100%;
        max-width: calc(100vw - 2rem);
        padding-bottom: 0;
    }

    .landing-hero h1 {
        max-width: 100%;
        font-size: clamp(2.65rem, 13vw, 3.55rem);
        line-height: 1.02;
    }

    .landing-kicker {
        max-width: 26ch;
        font-size: 0.68rem;
        line-height: 1.45;
    }

    .landing-hero-copy {
        width: min(33ch, calc(100vw - 2rem));
        max-width: 100%;
        font-size: 0.94rem;
        overflow-wrap: break-word;
    }

    .landing-actions,
    .admin-link-row {
        display: grid;
        grid-template-columns: 1fr;
        inline-size: min(100%, 20.75rem);
        max-inline-size: calc(100vw - 2rem);
        margin-right: auto;
        overflow: visible;
    }

    .landing-btn {
        inline-size: 100%;
        max-inline-size: 100%;
        min-inline-size: 0;
        box-sizing: border-box;
        justify-self: stretch;
        white-space: normal;
    }

    .landing-hero-proof {
        position: static;
        margin-top: 1.45rem;
        grid-template-columns: 1fr;
    }

    .landing-hero-proof div {
        padding: 0.8rem 0.9rem;
    }

    .landing-hero-proof span {
        display: none;
    }

    .landing-band {
        padding: 3.5rem 1rem;
    }

    .landing-section-heading,
    .landing-admin-panel,
    .landing-feature-grid,
    .admin-metrics {
        grid-template-columns: 1fr;
    }

    .landing-section-heading {
        gap: 0.5rem;
    }

    .landing-feature-grid {
        border-top: 1px solid var(--landing-line);
    }

    .landing-feature {
        border-right: 0;
        border-bottom: 1px solid var(--landing-line);
        padding: 1.5rem 0;
    }

    .landing-feature:last-child {
        border-bottom: 0;
    }

    .admin-metrics div {
        min-height: auto;
    }

    .landing-footer {
        display: grid;
        padding: 1rem;
    }
}

@media (max-width: 639px) and (max-height: 700px) {
    .landing-hero {
        padding-top: 5.35rem;
    }

    .landing-kicker {
        margin-bottom: 0.55rem;
    }

    .landing-hero h1 {
        font-size: clamp(2.35rem, 12vw, 3rem);
    }

    .landing-hero-copy {
        display: none;
    }

    .landing-actions {
        gap: 0.55rem;
        margin-top: 1.1rem;
    }

    .landing-btn {
        min-height: 46px;
        padding-top: 0.72rem;
        padding-bottom: 0.72rem;
    }

    .landing-hero-proof {
        margin-top: 1rem;
    }
}

/* ============================================================
   MEDIUM DEVICES (640px - 767px)
   ============================================================ */

@media (min-width: 640px) and (max-width: 767px) {
    .modal {
        align-items: center;
    }

    .modal-content {
        width: 90%;
        max-width: 500px;
        border-radius: var(--radius-lg);
        animation: popIn 0.3s ease;
    }

    @keyframes popIn {
        from {
            opacity: 0;
            transform: scale(0.9);
        }
        to {
            opacity: 1;
            transform: scale(1);
        }
    }

    .item-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-lg);
    }

    .hero-section {
        grid-column: 1 / -1;
    }

    .bid-block {
        grid-column: 1 / -1;
    }

    .bidding-section {
        grid-column: 1 / -1;
    }

    .bid-history {
        grid-column: 1 / -1;
    }

    .landing-nav {
        padding: 0.9rem 1.2rem;
    }

    .landing-hero {
        min-height: 94vh;
        padding-left: 1.4rem;
        padding-right: 1.4rem;
    }

    .landing-hero-content {
        padding-bottom: 12rem;
    }

    .landing-hero-proof,
    .landing-feature-grid,
    .landing-admin-panel {
        grid-template-columns: 1fr;
    }

    .landing-hero-proof {
        left: 1.4rem;
        right: 1.4rem;
    }

    .landing-feature {
        border-right: 0;
        border-bottom: 1px solid var(--landing-line);
    }

    .landing-feature:last-child {
        border-bottom: 0;
    }
}

/* ============================================================
   LARGE DEVICES (768px - 1023px)
   ============================================================ */

@media (min-width: 768px) {
    .container {
        max-width: 800px;
        padding: var(--spacing-lg);
    }

    .item-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-lg);
    }

    .hero-section {
        grid-column: 1;
        grid-row: 1 / 4;
        height: 400px;
    }

    .item-image {
        height: 100%;
        object-fit: cover;
    }

    .item-info {
        grid-column: 2;
        grid-row: 1;
    }

    .bid-block {
        grid-column: 2;
        grid-row: 2;
    }

    .countdown-section {
        grid-column: 2;
        grid-row: 3;
    }

    .bidding-section {
        grid-column: 2;
        grid-row: 4;
    }

    .bid-history {
        grid-column: 1 / -1;
    }

    .navigation-section {
        grid-column: 1 / -1;
        flex-direction: row;
    }

    .modal {
        align-items: center;
    }

    .modal-content {
        width: 90%;
        max-width: 500px;
        border-radius: var(--radius-lg);
        animation: popIn 0.3s ease;
    }

    .checkout-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-lg);
    }

    .success-container {
        min-height: auto;
        padding: var(--spacing-xl);
    }

    .landing-page .container {
        max-width: 1000px;
    }
}

/* ============================================================
   XLARGE DEVICES (1024px+)
   ============================================================ */

@media (min-width: 1024px) {
    :root {
        --font-size-base: 16px;
    }

    .container {
        max-width: 1000px;
        padding: var(--spacing-xl);
    }

    .bid-item {
        padding: var(--spacing-lg);
    }
}

/* ============================================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================================ */

@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 48px;
        min-width: 48px;
    }

    .form-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    input[type='tel'],
    input[type='text'],
    input[type='number'] {
        font-size: 16px;
    }
}

/* ============================================================
   LANDSCAPE ORIENTATION
   ============================================================ */

@media (max-height: 500px) {
    .auth-page .container {
        min-height: auto;
        padding: var(--spacing-md);
    }

    .auth-splash {
        padding: var(--spacing-md);
    }

    .splash-header h1 {
        font-size: var(--font-size-lg);
    }

    .form-group {
        margin-bottom: var(--spacing-sm);
    }

    .btn-large {
        margin-top: var(--spacing-sm);
    }
}

/* ============================================================
   HIGH DPI SCREENS (Retina)
   ============================================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn-spinner {
        width: 14px;
        height: 14px;
    }
}

/* ============================================================
   DARK MODE (Optional)
   ============================================================ */

@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode support */
    /*
    body {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }

    .auth-splash,
    .item-info,
    .bid-block,
    .bidding-section,
    .bid-history,
    .checkout-summary,
    .checkout-form {
        background-color: #2a2a2a;
        border-color: #404040;
    }

    .form-input {
        background-color: #1a1a1a;
        border-color: #404040;
        color: #e0e0e0;
    }

    .btn-secondary {
        background-color: #404040;
        color: #e0e0e0;
    }
    */
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    .app-header,
    .btn,
    .bidding-section {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .item-info,
    .bid-block {
        box-shadow: none;
        border: 1px solid black;
        page-break-inside: avoid;
    }
}

/* ============================================================
   ACCESSIBILITY
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   FOCUS STYLES (FOR KEYBOARD NAVIGATION)
   ============================================================ */

.btn:focus,
.form-input:focus,
a:focus {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* ============================================================
   CONTAINER QUERIES (FOR FUTURE USE)
   ============================================================ */

/* Support for container queries when widely available */
@supports (container-type: inline-size) {
    .item-info {
        container-type: inline-size;
    }

    @container (max-width: 400px) {
        .item-title {
            font-size: var(--font-size-lg);
        }
    }
}
