/* Variables */
:root {
    --bg-color: #05050a;
    --card-bg: rgba(15, 17, 30, 0.55);
    --border-color: rgba(255, 255, 255, 0.08);
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.5);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.5);
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.5);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Glow Effects */
.glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 45%),
                radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 1) 0%, rgba(5, 5, 10, 1) 100%);
    overflow: hidden;
}

.glow-bg::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 30%;
    width: 300px;
    height: 300px;
    background: var(--primary);
    filter: blur(150px);
    opacity: 0.15;
    border-radius: 50%;
    animation: float 20s infinite alternate ease-in-out;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 80px) scale(1.2); }
}

/* Container */
.container {
    width: 100%;
    max-width: 900px;
    padding: 24px;
    z-index: 10;
}

/* Screen Toggle */
.screen {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.screen.active {
    display: block;
    opacity: 1;
}

/* Cards & Glassmorphism */
.glassmorphism {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.card {
    padding: 32px;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Auth Screen */
.auth-card {
    text-align: center;
    max-width: 480px;
    margin: 0 auto;
}

.logo-area {
    margin-bottom: 24px;
}

.car-icon-glow {
    font-size: 48px;
    width: 90px;
    height: 90px;
    line-height: 90px;
    background: radial-gradient(circle, rgba(59,130,246,0.2) 0%, transparent 70%);
    border: 2px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto;
    box-shadow: 0 0 20px var(--primary-glow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 20px var(--primary-glow); }
    50% { transform: scale(1.05); box-shadow: 0 0 35px var(--primary-glow); }
}

h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--primary);
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.description {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 32px;
}

/* Buttons */
.btn {
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    padding: 14px 28px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.btn-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px var(--primary-glow);
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Loading Screen */
#loading-screen {
    text-align: center;
}

.loader {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    position: relative;
}

.loader .circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

.loader .circle:nth-child(2) {
    border-top-color: var(--success);
    transform: scale(0.8);
    animation: spin 1s linear infinite reverse;
}

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

/* Dashboard Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.badge {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 6px;
}

.header h2 {
    font-size: 26px;
    font-weight: 700;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-grid .card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

/* Battery Card Details */
.battery-card {
    grid-row: span 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

.battery-gauge-container {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 20px 0;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring__circle-bg {
    stroke: rgba(255, 255, 255, 0.05);
}

.progress-ring__circle {
    transition: stroke-dashoffset 0.6s ease;
}

.gauge-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
}

.gauge-content .percent {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -1px;
}

.gauge-content .state-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* Stats inside Battery Card */
.stats-row {
    width: 100%;
    display: flex;
    justify-content: space-around;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    margin-top: 16px;
}

.stat-item {
    text-align: center;
}

.stat-item .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 4px;
}

.stat-item .stat-value {
    font-size: 20px;
    font-weight: 600;
}

/* Controls Card */
.section-desc {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 24px;
}

.control-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.btn-control {
    width: 100%;
    justify-content: flex-start;
    padding: 16px 24px;
    font-size: 16px;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.btn-control:hover {
    transform: translateX(4px);
}

.btn-control .icon {
    font-size: 18px;
    width: 28px;
}

.btn-pause {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.btn-pause:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 10px 20px var(--danger-glow);
    border-color: transparent;
}

.btn-play {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.btn-play:hover {
    background: var(--success);
    color: white;
    box-shadow: 0 10px 20px var(--success-glow);
    border-color: transparent;
}

/* Info Box */
.info-alert {
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 16px;
    margin-top: 16px;
}

.alert-icon {
    color: var(--primary);
    font-weight: 700;
}

.info-alert p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Details Card */
.details-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.detail-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.detail-value {
    font-size: 14px;
    font-weight: 600;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

/* Messages & Feedback */
.error-msg {
    color: #f87171;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    margin-top: 16px;
    text-align: center;
}

.feedback-msg {
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.feedback-msg.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.feedback-msg.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Charging Animation for circular gauge */
.charging-pulse {
    animation: batteryGlow 3s infinite ease-in-out;
}

@keyframes batteryGlow {
    0%, 100% {
        filter: drop-shadow(0 0 4px var(--success-glow));
        stroke: var(--success);
    }
    50% {
        filter: drop-shadow(0 0 16px var(--success));
        stroke: #34d399;
    }
}
