:root {
    --bg-dark: #0f0c29;
    /* Deep Gradient Start */
    --bg-dark-end: #302b63;
    /* Deep Gradient End */
    --panel-bg: rgba(30, 28, 41, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --border-color: rgba(255, 255, 255, 0.1);
    --primary: #00d2ff;
    --accent: #FF5A36;
    --text-main: #ffffff;
    --text-muted: #a0a0b0;
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-dark-end), #24243e);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-main);
    height: 100vh;
    overflow: auto;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* App Header */
.app-header {
    background: rgba(19, 17, 28, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    border-bottom: 1px solid var(--glass-border);
    height: 70px;
    width: 100%;
    z-index: 100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-img {
    height: 36px;
    width: auto;
    object-fit: contain;
}

.app-header h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.header-actions {
    margin-left: auto !important;
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Search Bar Area */
.input-group {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(4px);
    border-radius: 12px;
    padding: 0.4rem 0.6rem;
    max-width: 650px;
    width: 100%;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.input-group:focus-within {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.2);
    transform: translateY(-1px);
}

.input-group:focus-within {
    border-color: rgba(255, 255, 255, 0.2);
}

#promptInput {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    outline: none;
    font-family: 'Inter', sans-serif;
}

#promptInput::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.icon-btn:hover {
    color: white;
}

.primary-btn {
    background: white;
    color: #13111C;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.1s;
}

.primary-btn:hover {
    transform: scale(1.02);
}

.sm-btn {
    background: #2A2836;
    border: 1px solid var(--border-color);
    color: #CFCFD6;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.sm-btn:hover {
    background: #353342;
    color: white;
}

/* New Selectors Styling */
.selectors-group {
    display: flex;
    gap: 0.8rem;
    margin-left: 0.5rem;
}

.styled-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23a0a0b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 4.5 6 7.5 9 4.5'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.styled-select:focus,
.styled-select:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    color: white;
}

.styled-select option {
    background: #1e1c29;
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    padding: 1rem;
    gap: 1rem;
    overflow: hidden;
    background: var(--bg-dark);
}

.panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.panel:hover {
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.2);
}

.left-panel {
    flex: 1;
    max-width: 420px;
}

.right-panel {
    flex: 2;
}

/* Tabs */
.tabs {
    display: flex;
    background: #1E1C29;
    padding: 0;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.tab-btn:hover {
    color: white;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    background: linear-gradient(to top, rgba(0, 210, 255, 0.05), transparent);
}

/* Tab Content Visibility */
.tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

.panel-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
}

.panel-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: white;
}

/* Breakdown List */
.breakdown-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.breakdown-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: #CFCFD6;
    display: flex;
    gap: 1rem;
    transition: background 0.2s;
}

.breakdown-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.breakdown-item.active {
    background: rgba(0, 210, 255, 0.05);
    border-left: 3px solid var(--primary);
}

.breakdown-time {
    color: var(--primary);
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    min-width: 40px;
}

/* Video Player Area */
.canvas-wrapper {
    flex: 1;
    background: #0D0B12;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

canvas {
    background: #1e1e2e;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    height: 100%;
    width: auto;
    max-width: 100%;
    aspect-ratio: 16/9;
    object-fit: contain;
}

/* Bottom Controls */
.bottom-controls {
    background: var(--panel-bg);
    padding: 1rem 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.playback-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.control-btn {
    background: #2A2836;
    border: 1px solid var(--border-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-btn:hover {
    background: #353342;
    border-color: rgba(255, 255, 255, 0.2);
}

#timelineScrub {
    flex: 1;
    height: 4px;
    background: #2A2836;
    border-radius: 2px;
    appearance: none;
    outline: none;
    cursor: pointer;
}

#timelineScrub::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border: 2px solid #1E1C29;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 2px var(--primary);
    transition: transform 0.1s;
}

#timelineScrub::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.accent-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.accent-btn:hover {
    background: #FF451A;
}

/* Toggle Switch */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2A2836;
    transition: .4s;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Utilities */
.hidden {
    display: none !important;
}

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #ff4b1f;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    gap: 1rem;
    align-items: center;
    z-index: 100;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

#loadingOverlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 1rem;
}

.auth-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--panel-radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    text-align: center;
}

.auth-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #00d2ff, #3a7bd5);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

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

.google-btn {
    background: white;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    width: 100%;
    padding: 0.8rem;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: transform 0.2s;
}

.google-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.auth-footer {
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-link:hover {
    text-decoration: underline;
}

/* Landing Page */
.landing-hero {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding-top: 10vh;
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #fff, #a5b3ce);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    line-height: 1.6;
}


/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.animate-slide-up {
    opacity: 0;
    animation: slideUp 0.6s ease-out forwards;
}

.animate-scale-in {
    opacity: 0;
    animation: scaleIn 0.5s ease-out forwards;
}

.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

.delay-4 {
    animation-delay: 0.4s;
}

/* Dashboard Specific Hover Effects */
.dashboard-card {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
}

.dashboard-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
    background: rgba(0, 210, 255, 0.2);
}

.card-icon {
    transition: transform 0.3s ease, background 0.3s ease;
}

.project-item {
    transition: transform 0.2s ease, background 0.2s ease;
}

.project-item:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.08);
}


/* Advanced Dashboard Styles */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.dashboard-header {
    margin-bottom: 3rem;
    position: relative;
}

.dashboard-header::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

.futuristic-card {
    background: rgba(20, 20, 35, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.futuristic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.03), transparent);
    transform: translateX(-100%);
    transition: 0.5s;
}

.futuristic-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px -10px rgba(0, 210, 255, 0.3);
}

.futuristic-card:hover::before {
    transform: translateX(100%);
}

.card-icon-wrapper {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: 0.3s;
}

.futuristic-card:hover .card-icon-wrapper {
    background: var(--primary);
    border-color: var(--primary);
    transform: rotate(10deg);
}

.futuristic-card:hover .card-icon-wrapper svg {
    stroke: white;
}

.project-list {
    background: rgba(20, 20, 35, 0.4);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.project-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: 0.3s;
}

.project-row:last-child {
    border-bottom: none;
}

.project-row:hover {
    background: rgba(255, 255, 255, 0.05);
    padding-left: 2rem;
}

/* Animated Background Grid */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 0;
    pointer-events: none;
    mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
}

/* Responsive Fixes */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 1rem;
    }

    .dashboard-header h2 {
        font-size: 1.5rem;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .project-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .project-row button {
        width: 100%;
    }

    .top-bar {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}


.btn-danger {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid rgba(231, 76, 60, 0.5);
    color: #ff6b6b;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.btn-danger:hover {
    background: rgba(231, 76, 60, 0.4);
    border-color: #ff6b6b;
    color: white;
}


.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.icon-btn.listening {
    color: #ff4b1f;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Code Highlighting */
.code-container {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #e6e6e6;
    background: #0D0B12;
    padding: 1rem;
    overflow-y: auto;
    height: 100%;
    white-space: pre;
    counter-reset: line;
}

.code-line {
    display: block;
    padding: 0 0.5rem;
    border-radius: 4px;
    min-height: 1.5em;
    /* Ensure empty lines have height */
    position: relative;
    padding-left: 3rem;
}

.code-line::before {
    counter-increment: line;
    content: counter(line);
    position: absolute;
    left: 0;
    top: 0;
    width: 2.5rem;
    text-align: right;
    color: #555;
    padding-right: 0.5rem;
    user-select: none;
}

.highlight-line {
    background: rgba(0, 210, 255, 0.15);
    color: #fff;
    border-left: 2px solid var(--primary);
}

/* --- UI Polish --- */

/* Loading Overlay - Glassmorphism */
#loadingOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 12, 41, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#loadingOverlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
}

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

/* Panel Transitions */
.panel {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}