/* ============================================
   AICA - Premium Dark Theme
   Merged: Working functionality + Premium design
   ============================================ */

:root {
    /* === Premium Dark Theme Colors === */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a26;
    --bg-card: #16161f;
    --bg-elevated: #1e1e2a;

    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #a855f7;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --accent-gradient: linear-gradient(
        135deg,
        #6366f1 0%,
        #8b5cf6 50%,
        #a855f7 100%
    );

    /* Cyber Accents */
    --cyber-blue: #00d4ff;
    --cyber-green: #00ff88;
    --cyber-pink: #ff006e;
    --cyber-orange: #ff9500;

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-muted: #475569;

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* === Legacy Variable Mapping (for existing HTML) === */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --secondary-light: #a78bfa;
    --dark: #f8fafc;
    --gray: #94a3b8;
    --gray-light: #64748b;
    --gray-lighter: #1e1e2a;
    --white: #12121a;
    --text: #f8fafc;

    /* Effects */
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.5);
    --glow-strong: 0 0 40px rgba(99, 102, 241, 0.3);
    --glow-subtle: 0 0 20px rgba(99, 102, 241, 0.15);

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(99, 102, 241, 0.3);
    --border-radius: 12px;

    /* Typography */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", monospace;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   HEADER / NAVIGATION
   ============================================ */

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    transition: var(--transition);
}

header.scrolled {
    background: rgba(10, 10, 15, 0.95);
    box-shadow: var(--shadow);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo h1 span {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

nav ul {
    display: flex;
    gap: 2rem;
    list-style: none;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-fast);
    position: relative;
}

nav a:hover,
nav a.active {
    color: var(--text-primary);
}

nav a.active::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 1px;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.login-btn {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
}

.login-btn:hover {
    color: var(--text-primary);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-accent);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   MAIN CONTAINER
   ============================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 100px 2rem 2rem;
}

.page-heading {
    text-align: center;
    margin-bottom: 2rem;
}

.page-heading h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(
        135deg,
        var(--text-primary) 0%,
        var(--text-secondary) 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   PROGRESS WIZARD
   ============================================ */

.progress-bar {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 3rem;
    position: relative;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0 2rem;
    cursor: pointer;
    transition: var(--transition);
}

.progress-step::before {
    content: "";
    position: absolute;
    top: 18px;
    left: -50%;
    width: 100%;
    height: 2px;
    background: var(--bg-elevated);
    z-index: 0;
}

.progress-step:first-child::before {
    display: none;
}

.progress-step.active::before,
.progress-step.completed::before {
    background: var(--accent-gradient);
}

.step-indicator {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

.progress-step.active .step-indicator {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.progress-step.completed .step-indicator {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.step-label {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-tertiary);
    transition: var(--transition);
}

.progress-step.active .step-label {
    color: var(--text-primary);
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

/* ============================================
   FORMS
   ============================================ */

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: var(--font-sans);
    font-size: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.25rem;
    padding-right: 3rem;
}

/* ============================================
   INPUT METHODS (Address/Upload Toggle)
   ============================================ */

.input-methods {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.input-method {
    flex: 1;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    font-weight: 500;
}

.input-method:hover {
    border-color: var(--border-accent);
    color: var(--text-primary);
}

.input-method.active {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.input-method i {
    margin-right: 0.5rem;
}

.input-content {
    display: none;
}

.input-content.active {
    display: block;
}

/* ============================================
   TAB CONTENT (Steps)
   ============================================ */

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* ============================================
   MAP CONTAINERS
   ============================================ */

.map-placeholder {
    height: 200px;
    background: var(--bg-secondary) !important;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted) !important;
    border: 1px dashed var(--border-light);
}

#map-viewport {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-subtle);
}

#map-container {
    background: var(--bg-secondary);
}

/* ============================================
   IMAGE UPLOAD
   ============================================ */

.image-preview {
    border: 2px dashed var(--border-light);
    border-radius: var(--border-radius);
    padding: 3rem;
    text-align: center;
    background: var(--bg-secondary);
    transition: var(--transition);
}

.image-preview:hover {
    border-color: var(--accent-primary);
    background: var(--bg-elevated);
}

.upload-icon {
    color: var(--text-muted);
}

.upload-icon i {
    color: var(--accent-primary);
}

/* ============================================
   VISUALIZATION CONTAINER (Analysis View)
   ============================================ */

.visualization-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 1.5rem;
    min-height: 600px;
}

.visualization-main {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.property-map {
    width: 100%;
    height: 100%;
    min-height: 500px;
    background: var(--bg-secondary);
}

.analysis-sidebar {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.sidebar-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-section h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   FEATURE LIST (Vulnerabilities)
   ============================================ */

.feature-list {
    list-style: none;
}

.feature-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.feature-tag {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.feature-tag.high {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.feature-tag.medium {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.feature-tag.low {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

/* ============================================
   LOADING OVERLAYS
   ============================================ */

#analysis-loading,
#detection-loading {
    background: rgba(10, 10, 15, 0.95) !important;
    color: var(--text-primary);
}

#analysis-loading h3,
#detection-loading h3 {
    color: var(--text-primary);
}

#analysis-loading p,
#detection-loading p {
    color: var(--text-secondary);
}

/* Progress bar styling */
#progress-bar,
#detection-progress-bar {
    background: var(--accent-gradient) !important;
}

/* Log console styling */
#progress-log,
#detection-log {
    background: var(--bg-secondary) !important;
    color: var(--cyber-green) !important;
    font-family: var(--font-mono);
    border: 1px solid var(--border-subtle);
}

/* ============================================
   CAMERA CARDS
   ============================================ */

.cameras-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.camera-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
}

.camera-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.camera-card.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.camera-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.camera-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.camera-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.camera-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.camera-feature {
    padding: 0.25rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ============================================
   ORDER SUMMARY
   ============================================ */

.order-summary-box {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 1px solid var(--border-subtle);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.summary-row:last-of-type {
    border-bottom: none;
}

.summary-total {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--accent-primary);
    font-size: 1.25rem;
    font-weight: 700;
    text-align: right;
    color: var(--text-primary);
}

/* Info box */
.card > div[style*="background: #e3f2fd"] {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-accent);
    color: var(--text-primary);
}

/* ============================================
   FOOTER
   ============================================ */

footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    padding: 3rem 2rem 1.5rem;
    margin-top: 4rem;
}

.footer-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.footer-column h3,
.footer-heading {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-column p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-links {
    list-style: none;
}

.footer-link {
    margin-bottom: 0.5rem;
}

.footer-link a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.footer-link a:hover {
    color: var(--accent-primary);
}

.copyright {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   MANUAL MODE (Structure Selection)
   ============================================ */

#manual-mode > div[style*="background: #e8f5e9"] {
    background: var(--bg-secondary) !important;
    border-color: var(--accent-primary) !important;
    color: var(--text-primary);
}

#manual-mode strong {
    color: var(--text-primary);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .visualization-container {
        grid-template-columns: 1fr;
    }

    .analysis-sidebar {
        order: -1;
    }
}

@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    nav ul {
        display: none;
    }

    .container {
        padding: 80px 1rem 1rem;
    }

    .page-heading h2 {
        font-size: 1.75rem;
    }

    .progress-step {
        padding: 0 0.5rem;
    }

    .step-label {
        font-size: 0.7rem;
    }

    .card {
        padding: 1.5rem;
    }

    .input-methods {
        flex-direction: column;
    }

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

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-center {
    text-align: center;
}
.text-right {
    text-align: right;
}
.mt-1 {
    margin-top: 0.5rem;
}
.mt-2 {
    margin-top: 1rem;
}
.mt-3 {
    margin-top: 1.5rem;
}
.mb-1 {
    margin-bottom: 0.5rem;
}
.mb-2 {
    margin-bottom: 1rem;
}
.mb-3 {
    margin-bottom: 1.5rem;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.3;
    }
    100% {
        transform: scale(1);
        opacity: 0.6;
    }
}

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

.fa-spin {
    animation: spin 1s linear infinite;
}
