:root {
    --bg-dark: #0f1117;
    --bg-card: #1a1d27;
    --border-color: #2a2d3a;
    --accent: #4f8cff;
    --accent-hover: #3b76e5;
    --text-primary: #e4e4e7;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --color-exceptional: #10b981;
    --color-strong: #06b6d4;
    --color-average: #f59e0b;
    --color-weak: #f97316;
    --color-poor: #ef4444;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: #ffffff;
    font-weight: 600;
}

/* Layout */
.app-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 24px 32px;
}

.header-content h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

.header-content .subtitle {
    color: var(--text-secondary);
    font-weight: 400;
}

.header-content .description {
    color: var(--text-secondary);
    font-size: 14px;
}

.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px;
}

/* Controls */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    gap: 16px;
    flex-wrap: wrap;
}

.controls-left, .controls-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

input[type="text"], input[type="url"], select, textarea {
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    appearance: auto;
}

select {
    padding-right: 8px; /* Adjusted to keep arrow less right-aligned */
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
}

.search-input {
    width: 250px;
}

/* Buttons */
.btn {
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s, color 0.2s;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
}

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

.btn-primary:disabled {
    background-color: var(--text-muted);
    cursor: not-allowed;
}

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

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

.btn-seed {
    background-color: transparent;
    color: var(--text-secondary);
    border: 1px dashed var(--text-muted);
}

.btn-seed:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
    background-color: rgba(255,255,255,0.05);
}

.help-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 0 0 0 rgba(79, 140, 255, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(79, 140, 255, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(79, 140, 255, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(79, 140, 255, 0); }
}

.help-btn:hover {
    background: var(--accent-hover);
}

.view-toggle {
    display: flex;
    gap: 4px;
}
.view-toggle .btn {
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.view-toggle .btn.active {
    background-color: var(--border-color);
    color: white;
}

/* Grid */
.venture-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .venture-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* Table */
.venture-table-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow-x: auto;
}

.venture-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.venture-table th {
    background-color: var(--bg-dark);
    text-align: left;
    padding: 14px 16px;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
}

.venture-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.venture-table tr:last-child td {
    border-bottom: none;
}

.venture-table tbody tr:hover {
    background-color: rgba(255,255,255,0.02);
    cursor: pointer;
}

/* Cards */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--text-muted);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.card-title {
    font-size: 18px;
    margin-bottom: 0;
}

.card-sector {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 12px;
    width: 100%;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    background-color: var(--border-color);
    color: var(--text-secondary);
}

.badge.sector-badge {
    background-color: transparent;
    border: 1px solid var(--border-color);
}

.score-badge {
    padding: 6px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
}

.card-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.card-rationale {
    font-size: 14px;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: auto;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    z-index: 101;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    width: 100%;
}

.detail-modal-content {
    max-width: 800px;
}

.form-modal-content {
    max-width: 500px;
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

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

/* Detail Modal Styles */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.detail-title {
    font-size: 28px;
    margin-bottom: 8px;
}

.detail-website {
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
}

.detail-website:hover {
    text-decoration: underline;
}

.detail-meta {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.detail-score-large {
    font-size: 18px;
    padding: 8px 12px;
}

.detail-section {
    margin-bottom: 32px;
}

.detail-section h3 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Sub-score Bars */
.subscore-item {
    margin-bottom: 12px;
}

.subscore-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 14px;
}

.subscore-bars {
    display: flex;
    gap: 4px;
    height: 8px;
}

.subscore-bar-segment {
    flex: 1;
    background-color: var(--border-color);
    border-radius: 2px;
}

.subscore-bar-segment.filled {
    background-color: var(--accent);
}

/* Lists */
.bullet-list {
    list-style-type: disc;
    padding-left: 20px;
    font-size: 14px;
}

.bullet-list li {
    margin-bottom: 8px;
}

/* Form Styles */
.form-help {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.form-group input, .form-group textarea {
    width: 100%;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

/* States */
.loading-state, .empty-state {
    text-align: center;
    padding: 64px 0;
    color: var(--text-secondary);
}

.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px auto;
}

.spinner.small {
    width: 16px;
    height: 16px;
    border-width: 2px;
    margin: 0;
}

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

.inline-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

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

/* Driver.js Overrides for Dark Mode */
.driver-popover {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 12px !important;
    padding: 24px !important;
    max-width: 550px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5) !important;
}

.driver-popover-title {
    color: #fff !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    margin-bottom: 16px !important;
    font-family: inherit !important;
}

.driver-popover-description {
    color: var(--text-secondary) !important;
    font-size: 14.5px !important;
    line-height: 1.6 !important;
    font-family: inherit !important;
}

.driver-popover-footer button {
    background-color: var(--accent) !important;
    color: white !important;
    border-radius: 6px !important;
    padding: 8px 16px !important;
    font-weight: 500 !important;
    font-family: inherit !important;
    border: none !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

.driver-popover-footer button:hover {
    background-color: var(--accent-hover) !important;
}

.driver-popover-close-btn {
    color: var(--text-secondary) !important;
}

.driver-popover-close-btn:hover {
    color: #fff !important;
}

.driver-popover-navigation-btns {
    gap: 8px !important;
}

/* Custom Flow Graphic inside Driver */
.flow-graphic {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 24px 0 8px 0;
    padding: 20px 16px;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.flow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    flex: 1;
}

.flow-step .icon {
    font-size: 24px;
    background: var(--bg-dark);
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--border-color);
}

.flow-step.highlight .icon {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(79, 140, 255, 0.2);
}

.flow-step .text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
}

.flow-arrow {
    color: var(--text-muted);
    font-size: 20px;
    padding: 0 8px;
}

.ai-bubble {
    background: rgba(79, 140, 255, 0.08);
    border: 1px solid rgba(79, 140, 255, 0.3);
    border-radius: 8px;
    padding: 12px;
    align-items: stretch !important;
    gap: 8px !important;
    flex: 1.6 !important;
}

.ai-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
}

.ai-header .icon {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
}

.ai-tasks {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 11px;
    color: var(--text-secondary);
    text-align: left;
}

.ai-tasks li {
    margin-bottom: 4px;
    padding-left: 12px;
    position: relative;
    line-height: 1.3;
}

.ai-tasks li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* Darken the Driver.js overlay instead of blur (browsers blur the SVG cutout hole if backdrop-filter is used) */
.driver-overlay {
    opacity: 0.85 !important;
}
