/**
 * Geometric Sizing Calculator - Mobile-First CSS
 *
 * Design goals:
 * - Ultra-compact (fits iPhone SE 375x667 without scroll)
 * - Touch-friendly (min 44px touch targets)
 * - Fast, fluid interactions
 */

/* ============================================================================
   App Container
   ============================================================================ */

.geo-app {
    max-width: 420px;
    margin: 0 auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: calc(100vh - 120px); /* Account for header/footer */
    min-height: calc(100dvh - 120px);
}

/* ============================================================================
   Header
   ============================================================================ */

.geo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--pk-container-border);
}

.geo-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--pk-text-primary);
}

.geo-help-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--pk-container-border);
    background: var(--pk-container);
    color: var(--pk-text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.geo-help-btn:hover,
.geo-help-btn:focus {
    background: var(--pk-accent);
    color: white;
    border-color: var(--pk-accent);
}

/* ============================================================================
   Inputs Section
   ============================================================================ */

.geo-inputs {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    background: var(--pk-container);
    border-radius: 12px;
    padding: 0.875rem;
}

.geo-input-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.geo-input-row label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--pk-text-secondary);
    min-width: 50px;
}

/* ============================================================================
   Stepper Component
   ============================================================================ */

.geo-stepper {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    justify-content: flex-end;
}

.stepper-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: var(--pk-background);
    color: var(--pk-text-primary);
    font-size: 1.25rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.stepper-btn:hover {
    background: var(--pk-accent);
    color: white;
}

.stepper-btn:active {
    transform: scale(0.95);
    background: var(--pk-accent);
    color: white;
}

.geo-stepper input {
    width: 70px;
    height: 44px;
    text-align: center;
    font-size: 1.125rem;
    font-weight: 600;
    font-family: var(--pk-font-mono);
    border: 1px solid var(--pk-container-border);
    border-radius: 8px;
    background: var(--pk-background);
    color: var(--pk-text-primary);
    padding: 0 0.25rem;
}

.geo-stepper input:focus {
    outline: none;
    border-color: var(--pk-accent);
    box-shadow: var(--shadow-focus-accent);
}

/* Hide number input spinners */
.geo-stepper input::-webkit-outer-spin-button,
.geo-stepper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.geo-stepper input[type=number] {
    -moz-appearance: textfield;
}

.geo-unit {
    font-size: 0.875rem;
    color: var(--pk-text-muted);
    font-weight: 500;
    min-width: 24px;
}

/* ============================================================================
   Presets
   ============================================================================ */

.geo-presets {
    display: flex;
    gap: 0.375rem;
    padding-top: 0.375rem;
}

.preset-btn {
    flex: 1;
    height: 36px;
    border: 1px solid var(--pk-container-border);
    border-radius: 6px;
    background: var(--pk-background);
    color: var(--pk-text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.preset-btn:hover {
    border-color: var(--pk-accent);
    color: var(--pk-accent);
}

.preset-btn.active {
    background: var(--pk-accent);
    border-color: var(--pk-accent);
    color: white;
}

/* ============================================================================
   Streets Selector
   ============================================================================ */

.geo-streets-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.375rem;
    border-top: 1px solid var(--pk-container-border);
    margin-top: 0.25rem;
}

.geo-streets-selector label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--pk-text-secondary);
}

.geo-radio-group {
    display: flex;
    gap: 0.375rem;
    background: var(--pk-background);
    padding: 4px;
    border-radius: 10px;
}

.street-btn {
    width: 52px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--pk-text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.street-btn:hover {
    background: var(--pk-container);
}

.street-btn.active {
    background: var(--pk-accent);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ============================================================================
   Main Result
   ============================================================================ */

.geo-result {
    text-align: center;
    padding: 1.25rem 0;
    background: var(--pk-container);
    border-radius: 16px;
    border: 1px solid var(--pk-container-border);
}

.geo-result .result-value {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--pk-text-primary);
    font-family: var(--pk-font-mono);
    line-height: 1;
    transition: transform 0.15s ease;
}

.geo-result .result-value.updating {
    transform: scale(1.02);
}

/* ============================================================================
   Breakdown by Street
   ============================================================================ */

.geo-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.street-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    background: var(--pk-container);
    border-radius: 8px;
}

.street-name {
    font-size: 0.875rem;
    color: var(--pk-text-secondary);
    font-weight: 500;
}

.street-bet {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--pk-text-primary);
    font-family: var(--pk-font-mono);
    text-align: right;
}

/* ============================================================================
   Summary
   ============================================================================ */

.geo-summary {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--pk-container);
    border-radius: 10px;
}

.summary-item {
    flex: 1;
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 0.75rem;
    color: var(--pk-text-muted);
    margin-bottom: 0.25rem;
}

.summary-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--pk-text-primary);
    font-family: var(--pk-font-mono);
}

/* ============================================================================
   Help Modal
   ============================================================================ */

.geo-modal {
    border: none;
    border-radius: 16px;
    padding: 0;
    max-width: 90vw;
    max-height: 85vh;
    width: 400px;
    background: var(--pk-container);
    color: var(--pk-text-primary);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.geo-modal::backdrop {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.geo-modal .modal-content {
    display: flex;
    flex-direction: column;
}

.geo-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--pk-container-border);
}

.geo-modal .modal-header h2 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.geo-modal .modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: var(--pk-background);
    color: var(--pk-text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.geo-modal .modal-close:hover {
    background: var(--pk-accent);
    color: white;
}

.geo-modal .modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.geo-modal .modal-body p {
    margin: 0 0 1rem;
    line-height: 1.6;
    color: var(--pk-text-secondary);
}

.geo-modal .modal-body p:last-child {
    margin-bottom: 0;
}

.geo-modal .modal-body strong {
    color: var(--pk-text-primary);
}

.geo-modal .modal-body code {
    display: inline-block;
    background: var(--pk-background);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: var(--pk-font-mono);
    font-size: 0.875rem;
    color: var(--pk-accent);
}

.geo-modal .modal-body em {
    color: var(--pk-accent);
    font-style: normal;
}

.geo-modal .modal-body a {
    color: var(--pk-accent);
    text-decoration: underline;
}

/* ============================================================================
   Desktop Adjustments (min-width: 768px)
   ============================================================================ */

@media (min-width: 768px) {
    .geo-app {
        padding: 1.5rem;
        gap: 1rem;
    }

    .geo-header h1 {
        font-size: 1.5rem;
    }

    .geo-inputs {
        padding: 1.25rem;
    }

    .geo-result {
        padding: 1.5rem 0;
    }

    .geo-result .result-value {
        font-size: 4rem;
    }

    .street-row {
        padding: 0.75rem 1rem;
    }
}

/* ============================================================================
   Animation Utilities
   ============================================================================ */

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.pulse {
    animation: pulse 0.3s ease;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
