/* CSS Variables for Theming */
:root {
    --bg-body: #f8fafc;
    --bg-panel: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --input-bg: #ffffff;
}

.dark {
    --bg-body: #0f172a;
    --bg-panel: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --input-bg: #0f172a;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s, color 0.3s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden; /* Prevent body scroll */
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Canvas Area */
.canvas-area {
    background-image: radial-gradient(var(--border) 1px, transparent 1px);
    background-size: 20px 20px;
    cursor: grab;
}
.canvas-area:active { cursor: grabbing; }

/* Form Controls */
.form-input {
    background-color: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    transition: all 0.2s;
}
.form-input:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

[x-cloak] { display: none !important; }

/* Loader */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-body);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Ads */
.ad-slot {
    width: 100%;
    background: rgba(0,0,0,0.05);
    border: 1px dashed var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    min-height: 100px;
    overflow: hidden;
}

/* Auth Modal */
.auth-modal {
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
}

/* Driver.js Custom Theme */
.driver-popover.custom-driver-popover {
    background-color: var(--bg-panel);
    color: var(--text-main);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 15px;
    font-family: inherit;
    border: 1px solid var(--border);
    z-index: 100000 !important;
}

.driver-popover.custom-driver-popover .driver-popover-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #3b82f6; /* Primary Blue */
    margin-bottom: 8px;
}

.driver-popover.custom-driver-popover .driver-popover-description {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-main);
}

.driver-popover.custom-driver-popover .driver-popover-footer {
    margin-top: 15px;
}

.driver-popover.custom-driver-popover button {
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
}

.driver-popover.custom-driver-popover .driver-popover-next-btn {
    background-color: #3b82f6;
    color: white;
    border: none;
    text-shadow: none;
}
.driver-popover.custom-driver-popover .driver-popover-next-btn:hover {
    background-color: #2563eb;
}

.driver-popover.custom-driver-popover .driver-popover-prev-btn,
.driver-popover.custom-driver-popover .driver-popover-close-btn {
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.driver-popover.custom-driver-popover .driver-popover-prev-btn:hover {
    background-color: rgba(0,0,0,0.05);
}

/* Dark mode specific overrides if parent has .dark class */
.dark .driver-popover.custom-driver-popover {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}
.dark .driver-popover.custom-driver-popover .driver-popover-description {
    color: #cbd5e1;
}
.dark .driver-popover.custom-driver-popover .driver-popover-prev-btn {
    color: #94a3b8;
    border-color: #475569;
}
.dark .driver-popover.custom-driver-popover .driver-popover-prev-btn:hover {
    background-color: rgba(255,255,255,0.05);
}
