/* ============================================================
   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);
    }

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

    .image-placeholder {
        height: 200px;
    }
}

/* ============================================================
   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;
    }
}

/* ============================================================
   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);
    }
}

/* ============================================================
   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);
        }
    }
}
