/* Reset and Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #f97316;
    --primary-hover: #ea580c;
    --primary-light: #fff7ed;
    --background: #fafaf9;
    --foreground: #1c1917;
    --muted: #78716c;
    --muted-light: #a8a29e;
    --border: #e7e5e4;
    --card: #ffffff;
    --success: #22c55e;
    --success-light: #dcfce7;
    --error: #ef4444;
    --error-light: #fef2f2;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Container */
.container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
.header {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-icon svg {
    width: 28px;
    height: 28px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--foreground);
}

.logo-tagline {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 500;
}

/* Main Content */
.main {
    flex: 1;
    padding: 24px 0;
}

/* Hero Section */
.hero {
    margin-bottom: 24px;
}

.hero h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--foreground);
}

.hero p {
    color: var(--muted);
    font-size: 0.938rem;
    line-height: 1.6;
}

/* Form Styles */
.form {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-of-type {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--foreground);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    color: var(--muted-light);
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 46px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--background);
    color: var(--foreground);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.input-wrapper input::placeholder {
    color: var(--muted-light);
}

/* Location Field */
.location-wrapper input {
    padding-right: 52px;
}

.detect-btn {
    position: absolute;
    right: 8px;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--primary-light);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: background-color 0.2s;
}

.detect-btn:hover {
    background: #fed7aa;
}

.detect-btn:active {
    transform: scale(0.95);
}

.detect-icon {
    width: 20px;
    height: 20px;
}

.detect-btn.loading .detect-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.location-status {
    font-size: 0.75rem;
    margin-top: 6px;
    color: var(--muted);
}

.location-status.error {
    color: var(--error);
}

.location-status.success {
    color: var(--success);
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 16px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s, transform 0.1s;
    font-family: inherit;
}

.submit-btn:hover {
    background: var(--primary-hover);
}

.submit-btn:active {
    transform: scale(0.98);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.hidden {
    display: none !important;
}

/* Emergency Call Section */
.emergency-call {
    margin-top: 24px;
    text-align: center;
    padding: 20px;
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.emergency-call p {
    font-size: 0.875rem;
    color: var(--muted);
    margin-bottom: 12px;
}

.call-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    border-radius: var(--radius);
    text-decoration: none;
    transition: background-color 0.2s;
}

.call-btn:hover {
    background: #fed7aa;
}

.call-btn svg {
    width: 20px;
    height: 20px;
}

/* Success View */
.success-content {
    text-align: center;
    padding: 24px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--success);
}

.success-icon svg {
    width: 40px;
    height: 40px;
}

.success-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--foreground);
}

.success-content > p {
    color: var(--muted);
    margin-bottom: 24px;
    line-height: 1.6;
}

.what-next {
    text-align: left;
    background: var(--background);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.what-next h3 {
    font-size: 0.938rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--foreground);
}

.what-next ul {
    list-style: none;
}

.what-next li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 10px;
    font-size: 0.875rem;
    color: var(--muted);
}

.what-next li:last-child {
    margin-bottom: 0;
}

.what-next li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

.new-request-btn {
    width: 100%;
    padding: 14px;
    font-size: 0.938rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: inherit;
}

.new-request-btn:hover {
    background: #fed7aa;
}

/* Footer */
.footer {
    padding: 16px 0;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer p {
    font-size: 0.75rem;
    color: var(--muted);
}

/* Responsive adjustments for larger screens */
@media (min-width: 640px) {
    .container {
        padding: 0 24px;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .form {
        padding: 32px;
    }
}
