:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #10b981;
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
    --critical-color: #dc2626;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --positive-color: #10b981;
}

[data-theme="light"] {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --critical-color: #dc2626;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --positive-color: #10b981;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

html {
    scroll-behavior: smooth;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    transition: background-color 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo-icon {
    font-size: 2rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

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

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
}

.theme-toggle {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
}

/* Sections */
.section {
    min-height: 100vh;
    padding: 6rem 2rem 4rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
}

/* Hero Section */
.hero-section {
    display: flex;
    align-items: center;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-large {
    padding: 1.25rem 2.5rem;
    font-size: 1.125rem;
}

.btn-icon {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

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

/* Hero Visual */
.hero-visual {
    position: relative;
    height: 400px;
}

.floating-card {
    position: absolute;
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    animation: float 3s ease-in-out infinite;
}

.card-1 {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.card-2 {
    top: 20%;
    right: 10%;
    animation-delay: 0.5s;
}

.card-3 {
    bottom: 30%;
    left: 20%;
    animation-delay: 1s;
}

.card-4 {
    bottom: 10%;
    right: 20%;
    animation-delay: 1.5s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Progress Section */
.progress-section {
    background-color: var(--surface-color);
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.progress-bar-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.progress-steps-horizontal {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    position: relative;
}

.progress-step-h {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 0 0 auto;
}

.step-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--bg-color);
    border: 3px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: all 0.4s ease;
    position: relative;
    z-index: 2;
}

.step-number {
    display: block;
}

.step-check {
    display: none;
    font-size: 2rem;
}

.progress-step-h.active .step-circle {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    animation: pulse 1.5s ease-in-out infinite;
}

.progress-step-h.completed .step-circle {
    border-color: var(--secondary-color);
    background-color: var(--secondary-color);
    color: white;
}

.progress-step-h.completed .step-number {
    display: none;
}

.progress-step-h.completed .step-check {
    display: block;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(59, 130, 246, 0.8);
    }
}

.step-label {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

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

.step-tooltip {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--surface-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
    border: 1px solid var(--border-color);
}

.progress-step-h:hover .step-tooltip {
    opacity: 1;
}

.progress-line {
    flex: 1;
    height: 3px;
    background-color: var(--border-color);
    margin: 0 1rem;
    position: relative;
    top: 30px;
    transition: background-color 0.4s ease;
}

.progress-step-h.completed + .progress-line {
    background-color: var(--secondary-color);
}

/* Results Section */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

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

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-pane {
    display: none;
}

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

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

/* Insights Legend */
.insights-legend {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.insights-legend h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.critical {
    background-color: var(--critical-color);
}

.legend-dot.warning {
    background-color: var(--warning-color);
}

.legend-dot.info {
    background-color: var(--info-color);
}

.legend-dot.positive {
    background-color: var(--positive-color);
}

/* Insights Grid */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.insight-card {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.insight-card.critical {
    border-left-color: var(--critical-color);
}

.insight-card.warning {
    border-left-color: var(--warning-color);
}

.insight-card.info {
    border-left-color: var(--info-color);
}

.insight-card.positive {
    border-left-color: var(--positive-color);
}

.insight-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

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

.insight-type {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.insight-expand-icon {
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.insight-card.critical .insight-type {
    background-color: rgba(220, 38, 38, 0.1);
    color: var(--critical-color);
}

.insight-card.warning .insight-type {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.insight-card.info .insight-type {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.insight-card.positive .insight-type {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--positive-color);
}

.insight-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.insight-summary {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-primary);
    flex: 1;
}

.insight-detail {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-section {
    line-height: 1.7;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section strong {
    display: block;
    color: var(--primary-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.detail-section.prediction {
    background-color: rgba(245, 158, 11, 0.1);
    padding: 0.75rem;
    border-radius: 0.5rem;
    border-left: 3px solid var(--warning-color);
}

.detail-section.prediction strong {
    color: var(--warning-color);
}

.insight-sources {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.sources-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.source-tag {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* Actions Table */
.table-container {
    background-color: var(--surface-color);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: var(--primary-color);
    color: white;
}

th, td {
    padding: 1rem;
    text-align: left;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

tbody tr:hover {
    background-color: var(--bg-color);
}

/* Emails Container */
.emails-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.email-card {
    background-color: var(--surface-color);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all 0.3s ease;
}

.email-header {
    padding: 1.5rem;
    background-color: var(--bg-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.email-header:hover {
    background-color: var(--border-color);
}

.email-dept {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.125rem;
}

.email-subject {
    font-weight: 600;
    margin-top: 0.25rem;
}

.email-toggle {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.email-card.expanded .email-toggle {
    transform: rotate(180deg);
}

.email-body {
    padding: 1.5rem;
    display: none;
    border-top: 1px solid var(--border-color);
}

.email-card.expanded .email-body {
    display: block;
}

.email-content {
    white-space: pre-wrap;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.copy-btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background-color: #059669;
    transform: translateY(-2px);
}

/* About Section */
.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.about-card {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: all 0.3s ease;
}

.about-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.about-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.about-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.about-card p {
    color: var(--text-secondary);
    line-height: 1.8;
}

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

.dataset-card {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.dataset-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary-color);
    cursor: pointer;
}

.dataset-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.dataset-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.dataset-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--surface-color);
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    animation: slideUp 0.3s ease;
}

.dataset-modal-content {
    max-width: 900px;
    width: 95%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

.dataset-modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    position: relative;
}

.dataset-modal-body table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.dataset-modal-body table th {
    position: sticky;
    top: 0;
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid var(--primary-dark);
}

.dataset-modal-body table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--surface-color);
}

.dataset-modal-body table tbody tr:hover td {
    background-color: var(--bg-color);
}

.dataset-modal-body > p {
    padding: 2rem;
    text-align: center;
}

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

.modal-content h2 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    background-color: var(--bg-color);
    color: var(--text-primary);
    transition: border-color 0.3s ease;
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero-visual {
        display: none;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .nav-link {
        font-size: 0.875rem;
    }

    .section {
        padding: 5rem 1rem 2rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .tabs {
        overflow-x: auto;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
}
