/* ============================================
   Life Radio Mitfahren - Design System
   Apple-like, circle design, #FFED00 primary
   ============================================ */

:root {
    /* Colors */
    --primary: #FFED00;
    --primary-hover: #E6D500;
    --primary-light: #FFF9B0;
    --black: #000000;
    --white: #FFFFFF;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Surfaces */
    --bg: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-card: #FFFFFF;
    --text: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --border: #E5E7EB;
    --shadow: rgba(0, 0, 0, 0.08);
    --shadow-lg: rgba(0, 0, 0, 0.12);

    /* Status */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    /* Layout */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;

    /* Typography */
    --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

    /* Transitions */
    --transition: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* Safe areas */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0A0A0A;
        --bg-secondary: #141414;
        --bg-card: #1A1A1A;
        --text: #F9FAFB;
        --text-secondary: #9CA3AF;
        --text-muted: #6B7280;
        --border: #2D2D2D;
        --shadow: rgba(0, 0, 0, 0.3);
        --shadow-lg: rgba(0, 0, 0, 0.5);
    }
}

[data-theme="dark"] {
    --bg: #0A0A0A;
    --bg-secondary: #141414;
    --bg-card: #1A1A1A;
    --text: #F9FAFB;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --border: #2D2D2D;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

a {
    color: var(--black);
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ============================================
   Loading Screen
   ============================================ */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    text-align: center;
}

.logo-circle {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 4px 20px rgba(255, 237, 0, 0.3);
}

.logo-text {
    font-size: 28px;
    font-weight: 800;
    color: var(--black);
}

.loading-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   App Layout
   ============================================ */
.app-container {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.app-header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-header .logo-circle {
    width: 36px;
    height: 36px;
    margin: 0;
}

.app-header .logo-circle .logo-text {
    font-size: 14px;
}

.app-header .logo h2 {
    font-size: 18px;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-content {
    flex: 1;
    padding: 16px;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
}

.app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + var(--safe-bottom));
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    transition: color var(--transition);
    cursor: pointer;
    border: none;
    background: none;
}

.nav-item.active {
    color: var(--black);
}

.nav-item .nav-icon {
    font-size: 22px;
    line-height: 1;
}

.nav-item .badge {
    position: absolute;
    top: -2px;
    right: -6px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    line-height: 1;
    -webkit-appearance: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: var(--black);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 16px rgba(255, 237, 0, 0.4);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    padding: 10px 16px;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 18px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-full);
    font-size: 18px;
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: var(--font);
    background: var(--bg-card);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 237, 0, 0.2);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input.error {
    border-color: var(--danger);
}

.form-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 4px;
}

.form-hint {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

textarea.form-input {
    min-height: 100px;
    resize: vertical;
}

select.form-input {
    cursor: pointer;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: 0 4px 12px var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

/* ============================================
   Avatar
   ============================================ */
.avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    object-fit: cover;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: var(--black);
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 24px;
}

.avatar-xl {
    width: 96px;
    height: 96px;
    font-size: 36px;
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-light);
    color: var(--black);
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 50px;
}

/* ============================================
   Rating Stars
   ============================================ */
.stars {
    display: inline-flex;
    gap: 2px;
    color: var(--primary);
    font-size: 16px;
}

.stars .empty {
    color: var(--gray-300);
}

/* ============================================
   Ride Card
   ============================================ */
.ride-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ride-route {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.ride-route-dots {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding-top: 4px;
}

.ride-route-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: var(--primary);
    border: 2px solid var(--black);
}

.ride-route-dot.dest {
    background: var(--black);
}

.ride-route-line {
    width: 2px;
    height: 24px;
    background: var(--border);
}

.ride-route-addresses {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ride-route-address {
    font-size: 15px;
    font-weight: 500;
}

.ride-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.ride-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ride-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.ride-price small {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
}

/* ============================================
   Status Badge
   ============================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
}

.status-open { background: #ECFDF5; color: #059669; }
.status-confirmed { background: #EFF6FF; color: #2563EB; }
.status-in-progress { background: #FFF7ED; color: #EA580C; }
.status-completed { background: var(--gray-100); color: var(--gray-600); }
.status-cancelled { background: #FEF2F2; color: #DC2626; }

/* ============================================
   Auth Pages
   ============================================ */
.auth-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-circle {
    width: 72px;
    height: 72px;
    margin: 0 auto 12px;
}

.auth-logo h1 {
    font-size: 26px;
    font-weight: 700;
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 4px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.btn-google {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    width: 100%;
    padding: 14px;
    font-size: 15px;
}

.btn-google:hover {
    background: var(--bg-secondary);
}

.btn-google svg {
    width: 18px;
    height: 18px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--text);
    font-weight: 600;
}

/* ============================================
   Alert / Toast
   ============================================ */
.toast-container {
    position: fixed;
    top: calc(16px + var(--safe-top));
    left: 16px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: 0 8px 24px var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    animation: slideDown 0.3s ease;
    font-size: 14px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

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

/* ============================================
   Emergency Button
   ============================================ */
.emergency-btn {
    position: fixed;
    bottom: calc(80px + var(--safe-bottom));
    right: 16px;
    width: 56px;
    height: 56px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition);
}

.emergency-btn:active {
    transform: scale(0.9);
}

/* ============================================
   Life Radio Player
   ============================================ */
.radio-player {
    background: var(--black);
    color: var(--white);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.radio-player .play-btn {
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: var(--black);
    border: none;
    border-radius: var(--radius-full);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--transition);
}

.radio-player .play-btn:active {
    transform: scale(0.9);
}

.radio-player-info {
    flex: 1;
}

.radio-player-label {
    font-size: 12px;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.radio-player-title {
    font-size: 16px;
    font-weight: 600;
}

.radio-equalizer {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 24px;
}

.radio-equalizer .bar {
    width: 3px;
    background: var(--primary);
    border-radius: 2px;
    animation: eq 0.8s ease-in-out infinite alternate;
}

.radio-equalizer .bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.radio-equalizer .bar:nth-child(2) { height: 16px; animation-delay: 0.15s; }
.radio-equalizer .bar:nth-child(3) { height: 12px; animation-delay: 0.3s; }
.radio-equalizer .bar:nth-child(4) { height: 20px; animation-delay: 0.45s; }
.radio-equalizer .bar:nth-child(5) { height: 10px; animation-delay: 0.6s; }

.radio-equalizer.paused .bar {
    animation: none;
    height: 4px !important;
}

@keyframes eq {
    0% { height: 4px; }
    100% { height: 24px; }
}

/* ============================================
   Story Recording
   ============================================ */
.record-btn {
    width: 72px;
    height: 72px;
    background: var(--danger);
    color: white;
    border: 4px solid var(--white);
    border-radius: var(--radius-full);
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 0 0 4px var(--danger);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.record-btn.recording {
    animation: pulse-record 1.5s ease infinite;
}

@keyframes pulse-record {
    0%, 100% { box-shadow: 0 0 0 4px var(--danger); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.3); }
}

/* ============================================
   Map
   ============================================ */
.map-container {
    width: 100%;
    height: 300px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.map-container.fullscreen {
    position: fixed;
    inset: 0;
    height: 100%;
    border-radius: 0;
    z-index: 50;
}

/* ============================================
   Chat
   ============================================ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 15px;
    line-height: 1.4;
}

.chat-bubble.sent {
    align-self: flex-end;
    background: var(--primary);
    color: var(--black);
    border-bottom-right-radius: 4px;
}

.chat-bubble.received {
    align-self: flex-start;
    background: var(--bg-secondary);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.chat-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.chat-input-bar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.chat-input-bar input {
    flex: 1;
}

/* ============================================
   Quick Actions (Chat templates)
   ============================================ */
.quick-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 8px 16px;
}

.quick-action {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 13px;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.quick-action:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--black);
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

/* ============================================
   Skeleton Loading
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   Utilities
   ============================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.relative { position: relative; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }

/* Bottom navigation spacer */
.nav-spacer {
    height: calc(72px + var(--safe-bottom));
}
