:root {
    --bg-dark: #090D16;
    --bg-card: #151D2A;
    --border-color: #232E42;
    --primary: #00E5FF;
    --primary-hover: #00B8D4;
    --success: #00E676;
    --warning: #FFAB00;
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app-viewport {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0D131F;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    position: relative;
    padding: 1rem;
}

/* App Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 0.75rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.app-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #FFFFFF;
}

.app-subtitle {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:active {
    background: rgba(255, 255, 255, 0.15);
}

/* Vehicle Pill */
.vehicle-pill {
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 25px;
    padding: 0.5rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

/* Main Content & Cards */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.state-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem 1.2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    flex: 1;
    justify-content: center;
}

.card-icon {
    font-size: 3rem;
}

/* Active Trip Card & QR Area */
.active-trip-card {
    justify-content: space-between;
    padding: 1.2rem;
    gap: 1rem;
}

.qr-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.badge-live {
    background: rgba(0, 230, 118, 0.15);
    color: var(--success);
    border: 1px solid rgba(0, 230, 118, 0.3);
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.locator-tag {
    font-family: 'Space Grotesk', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: #FFFFFF;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    border: 1px dashed var(--border-color);
}

.qr-wrapper {
    background: #FFFFFF;
    padding: 1rem;
    border-radius: 16px;
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: 280px;
    width: 100%;
}

#qrcode-box img, #qrcode-box canvas {
    display: block;
    margin: auto;
    width: 230px !important;
    height: 230px !important;
}

.qr-instruction {
    color: #334155;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.3;
}

/* Trip Summary */
.trip-summary {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

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

.summary-row .label {
    color: var(--text-muted);
    font-weight: 600;
}

.summary-row .val {
    color: #FFFFFF;
    font-weight: 700;
    max-width: 65%;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border-radius: 14px;
    border: none;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #00B0FF);
    color: #090D16;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-action {
    background: linear-gradient(135deg, #00E676, #00C853);
    color: #090D16;
    font-size: 1.05rem;
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.3);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

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

.modal-header h2 {
    font-size: 1.1rem;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-group input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    color: #FFFFFF;
    font-family: 'Space Grotesk', monospace;
    font-size: 1rem;
    text-transform: uppercase;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Footer */
.app-footer {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0.5rem 0.2rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-link {
    color: var(--text-muted);
    text-decoration: underline;
}

/* Spinner */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(0, 229, 255, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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