/* ==========================================================================
   VitiRoutes - Mobile PWA Luxury Wine Design System
   Color Palette: Burgundy (#581825), Gold (#D4AF37), Slate Dark (#1E293B)
   ========================================================================== */

:root {
    --primary-burgundy: #581825;
    --primary-dark: #3b0f18;
    --primary-light: #7a2233;
    --accent-gold: #d4af37;
    --accent-gold-light: #f5e6a3;
    --bg-dark: #0f172a;
    --surface-dark: rgba(30, 41, 59, 0.88);
    --surface-card: #1e293b;
    --surface-glass: rgba(30, 41, 59, 0.75);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Pin Recency Colors */
    --status-green: #10b981;
    --status-orange: #f59e0b;
    --status-red: #ef4444;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.25);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --border-glass: 1px solid rgba(255, 255, 255, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

/* Glassmorphism Card Style */
.glass-card {
    background: var(--surface-dark);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-glass);
}

/* Header */
.app-header {
    height: 60px;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-burgundy) 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 60%;
}

.brand-icon {
    font-size: 1.6rem;
}

.brand-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
    white-space: nowrap;
}

.brand-subtitle {
    font-size: 0.65rem;
    color: var(--accent-gold);
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.btn-action-highlight {
    background: linear-gradient(135deg, #b45309, #d97706);
    border: 1px solid var(--accent-gold);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: transform 0.15s ease;
}

.btn-action-highlight:active {
    transform: scale(0.96);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: white;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Route & Corridor Panel */
.route-panel {
    position: absolute;
    top: 70px;
    left: 12px;
    right: 12px;
    z-index: 1000;
    padding: 16px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
}

.route-panel.collapsed {
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
}

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

.panel-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent-gold-light);
}

.route-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.input-group input, .input-group select, .input-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.85rem;
    font-family: inherit;
}

.input-group input:focus, .input-group select:focus, .input-group textarea:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.input-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.input-group input[type="range"] {
    accent-color: var(--accent-gold);
    padding: 0;
    height: 6px;
}

.route-btn-row {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.btn-primary {
    flex: 1;
    background: linear-gradient(135deg, var(--primary-burgundy), var(--primary-light));
    border: 1px solid var(--accent-gold);
    color: white;
    padding: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 12px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.btn-full {
    width: 100%;
}

/* Recency Legend */
.legend-container {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
}

.legend-title {
    color: var(--text-muted);
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.dot-green { background-color: var(--status-green); }
.dot-orange { background-color: var(--status-orange); }
.dot-red { background-color: var(--status-red); }

/* Map Wrapper */
.map-wrapper {
    flex: 1;
    position: relative;
    width: 100%;
    height: calc(100vh - 60px);
}

#map {
    width: 100%;
    height: 100%;
    background-color: #0f172a;
}

/* Proximity Alert Toast */
.proximity-card {
    position: absolute;
    top: 75px;
    left: 14px;
    right: 14px;
    z-index: 1100;
    padding: 14px;
    border-left: 4px solid var(--accent-gold);
    animation: slideDown 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

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

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

.proximity-tag {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-gold);
    text-transform: uppercase;
}

.pulse-indicator {
    width: 10px;
    height: 10px;
    background-color: var(--accent-gold);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(212, 175, 55, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); }
}

.proximity-body h4 {
    font-size: 1.05rem;
    color: #fff;
    margin-bottom: 4px;
}

.proximity-body p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.3;
    margin-bottom: 2px;
}

.proximity-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.btn-action {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-align: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.btn-call { background: var(--status-green); color: white; }
.btn-open { background: var(--primary-burgundy); border: 1px solid var(--accent-gold); color: white; }
.btn-waze { background: #00d6ff; color: #0f172a; }

/* Floating Voice Bar */
.floating-voice-bar {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 1000;
    pointer-events: none;
}

.btn-voice {
    pointer-events: auto;
    background: linear-gradient(135deg, var(--primary-burgundy), #831843);
    border: 2px solid var(--accent-gold);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-voice:active {
    transform: scale(0.96);
}

.btn-voice .mic-icon {
    font-size: 1.2rem;
}

/* Client Detail Drawer */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
}

.drawer-content {
    width: 100%;
    max-height: 85vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #182234;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
}

.badge-type {
    font-size: 0.7rem;
    padding: 3px 8px;
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent-gold);
    border-radius: var(--radius-full);
    border: 1px solid var(--accent-gold);
    display: inline-block;
    margin-bottom: 4px;
}

.drawer-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.35rem;
    color: #fff;
}

.drawer-address {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-close, .btn-close-sm {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.btn-quick {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.btn-highlight {
    background: linear-gradient(135deg, var(--primary-burgundy), var(--primary-light));
    border-color: var(--accent-gold);
}

.drawer-section {
    background: rgba(15, 23, 42, 0.6);
    border-radius: var(--radius-sm);
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.drawer-section h3 {
    font-size: 0.85rem;
    color: var(--accent-gold-light);
    margin-bottom: 8px;
}

.btn-text-action {
    background: none;
    border: none;
    color: var(--accent-gold);
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: underline;
}

/* Rating List */
.ratings-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rating-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.stars {
    color: var(--accent-gold);
    letter-spacing: 2px;
}

/* Timeline and Notes */
.timeline-item, .note-item, .review-item {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.8rem;
}

.timeline-item:last-child, .note-item:last-child, .review-item:last-child {
    border-bottom: none;
}

.item-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.badge-voice {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
}

/* Modal Popup & Forms */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-content {
    width: 100%;
    max-width: 480px;
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* Address Autocomplete & Geocoding Styles */
.address-autocomplete-container {
    position: relative;
}

.address-suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #0f172a;
    border: 1px solid var(--accent-gold);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    z-index: 3000;
    max-height: 180px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.address-suggestion-item {
    padding: 8px 12px;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.address-suggestion-item:hover {
    background: rgba(212, 175, 55, 0.15);
    color: var(--accent-gold-light);
}

.geo-hint {
    display: block;
    font-size: 0.7rem;
    color: var(--accent-gold);
    margin-top: 3px;
}

/* Order Client Banner */
.order-client-banner {
    background: rgba(88, 24, 37, 0.4);
    border: 1px solid var(--primary-light);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--accent-gold-light);
}

/* Authentication Modal */
.auth-modal-card {
    max-width: 420px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    background: rgba(15, 23, 42, 0.8);
    padding: 4px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.auth-tab {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab.active {
    background: var(--primary-burgundy);
    color: white;
    border: 1px solid var(--accent-gold);
}

.auth-error-msg {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--status-red);
    color: #fca5a5;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
}

.user-profile-badge {
    text-align: center;
    padding: 16px 0;
}

.avatar-circle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-burgundy), var(--primary-light));
    border: 2px solid var(--accent-gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 12px auto;
}

.user-profile-badge h4 {
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 4px;
}

.user-profile-badge p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Voice Dictation Box */
.voice-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.client-picker-row {
    margin-bottom: 12px;
}

.client-picker-row label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.client-picker-row select {
    width: 100%;
    padding: 8px 10px;
    background: #0f172a;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
}

.transcript-box {
    min-height: 120px;
    background: #0b1120;
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: var(--radius-sm);
    padding: 12px;
    position: relative;
    margin-bottom: 16px;
}

.live-transcript {
    font-size: 0.95rem;
    line-height: 1.4;
    color: #fff;
    min-height: 80px;
}

.recording-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 24px;
    margin-top: 8px;
}

.wave-bar {
    width: 4px;
    height: 100%;
    background-color: var(--status-red);
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.wave-bar:nth-child(2) { animation-delay: 0.2s; }
.wave-bar:nth-child(3) { animation-delay: 0.4s; }
.wave-bar:nth-child(4) { animation-delay: 0.6s; }

@keyframes wave {
    0%, 100% { height: 6px; }
    50% { height: 22px; }
}

.btn-record-active {
    flex: 1;
    background: #991b1b;
    border: none;
    color: white;
    padding: 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}

.hidden {
    display: none !important;
}
