/* Shared theme-aware styles for AutoFYN */

/* Base styles */
body {
    background: var(--bg);
    color: var(--text);
    transition: background 0.2s ease, color 0.2s ease;
}

/* Header/Dropdown */
.dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-2);
}

.dropdown-menu a {
    color: var(--text);
}

.dropdown-menu a:hover {
    background: var(--surface-2);
}

/* Profile icon */
.profile-icon {
    background: var(--primary-gradient);
    border-color: var(--border);
}

.profile-icon:hover {
    box-shadow: var(--shadow-hover);
}

/* Text colors */
.subtitle,
.welcome-message {
    color: var(--text);
}

/* Dashboard header - keep text dark in light mode */
.header-section .subtitle,
.header-section .welcome-message {
    color: var(--text);
}

/* Activity section */
.activity-section {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-2);
}

.activity-section h2 {
    color: var(--text);
}

.activity-placeholder {
    color: var(--text-muted);
}

.activity-spinner {
    border-color: var(--border);
    border-top-color: var(--primary);
}

/* Tables */
.activity-table {
    background: var(--surface);
    box-shadow: var(--shadow-2);
}

.activity-table th {
    background: var(--surface-2);
    color: var(--text);
}

.activity-table td {
    border-bottom-color: var(--border);
    color: var(--text);
}

.activity-table tr:hover {
    background: var(--surface-2);
}

.activity-row.expandable:hover {
    background: var(--surface-3) !important;
}

.activity-details-row td {
    color: var(--text-2);
}

.job-id-short {
    color: var(--text-2);
}

/* Status badges */
.status-completed {
    background: var(--success-bg);
    color: var(--success-text);
}

.status-running,
.status-processing {
    background: var(--info-bg);
    color: var(--info-text);
}

.status-failed {
    background: var(--error-bg);
    color: var(--error-text);
}

/* Tool badges */
.tool-enrich {
    background: var(--info-bg);
    color: var(--info-text);
}

.tool-pipeline {
    background: rgba(66, 153, 225, 0.25);
    color: var(--info-text);
}

.tool-search {
    background: var(--success-bg);
    color: var(--success-text);
}

.tool-icyai {
    background: var(--warn-bg);
    color: var(--warn-text);
}

.tool-classifier {
    background: rgba(153, 122, 234, 0.18);
    color: #9f7aea;
}

.tool-seekrai {
    background: rgba(37, 99, 235, 0.25);
    color: #2563eb;
}

:root[data-theme="dark"] .tool-classifier {
    color: #d8b4fe;
}

:root[data-theme="dark"] .tool-seekrai {
    color: #60a5fa;
}

/* Buttons */
.download-btn {
    background: var(--primary-gradient);
}

.download-btn:hover {
    box-shadow: 0 4px 12px var(--focus-ring);
}

.download-btn:disabled {
    background: var(--border);
}

/* Feature tiles - use surface with gradients */
.feature-button {
    background: var(--surface);
    box-shadow: var(--shadow-2);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.feature-button:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
    transform: translateY(-5px);
}

/* Tile variants with solid color */
.enrich-btn {
    background: var(--surface);
}

.search-btn {
    background: var(--surface);
}

.icyai-btn {
    background: var(--surface);
}

.classifier-btn {
    background: var(--surface);
}

.conflix-btn {
    background: var(--surface);
}

.bowpublica-btn {
    background: var(--surface);
}

/* Dark mode override */
:root[data-theme="dark"] .enrich-btn,
:root[data-theme="dark"] .search-btn,
:root[data-theme="dark"] .icyai-btn,
:root[data-theme="dark"] .classifier-btn,
:root[data-theme="dark"] .conflix-btn,
:root[data-theme="dark"] .bowpublica-btn {
    background: #2d3748;
}

.orchestrate-btn {
    background: var(--primary-gradient);
    border-color: var(--border);
}

.orchestrate-btn:hover {
    box-shadow: var(--shadow-hover);
}

/* Loading overlay */
.loading-overlay {
    background: var(--primary-gradient);
}

/* Footer */
.footer {
    color: var(--text-muted);
}

/* Focus visibility */
:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

/* Theme toggle button - Animated Sun/Moon Switch */
.theme-switch {
    --toggle-size: 30px;
    --container-width: 5.625em;
    --container-height: 2.5em;
    --container-radius: 6.25em;
    --container-light-bg: #3D7EAE;
    --container-night-bg: #1D1F2C;
    --circle-container-diameter: 3.375em;
    --sun-moon-diameter: 2.125em;
    --sun-bg: #ECCA2F;
    --moon-bg: #C4C9D1;
    --spot-color: #959DB1;
    --circle-container-offset: calc((var(--circle-container-diameter) - var(--container-height)) / 2 * -1);
    --stars-color: #fff;
    --clouds-color: #F3FDFF;
    --back-clouds-color: #AACADF;
    --transition: .5s cubic-bezier(0, -0.02, 0.4, 1.25);
    --circle-transition: .3s cubic-bezier(0, -0.02, 0.35, 1.17);
}

.theme-switch, .theme-switch *, .theme-switch *::before, .theme-switch *::after {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-size: var(--toggle-size);
}

.theme-switch__container {
    width: var(--container-width);
    height: var(--container-height);
    background-color: var(--container-light-bg);
    border-radius: var(--container-radius);
    overflow: hidden;
    cursor: pointer;
    -webkit-box-shadow: 0em -0.062em 0.062em rgba(0, 0, 0, 0.25), 0em 0.062em 0.125em rgba(255, 255, 255, 0.94);
    box-shadow: 0em -0.062em 0.062em rgba(0, 0, 0, 0.25), 0em 0.062em 0.125em rgba(255, 255, 255, 0.94);
    -webkit-transition: var(--transition);
    -o-transition: var(--transition);
    transition: var(--transition);
    position: relative;
}

.theme-switch__container::before {
    content: "";
    position: absolute;
    z-index: 1;
    inset: 0;
    -webkit-box-shadow: 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset, 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset;
    box-shadow: 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset, 0em 0.05em 0.187em rgba(0, 0, 0, 0.25) inset;
    border-radius: var(--container-radius);
}

.theme-switch__checkbox {
    display: none;
}

.theme-switch__circle-container {
    width: var(--circle-container-diameter);
    height: var(--circle-container-diameter);
    background-color: rgba(255, 255, 255, 0.1);
    position: absolute;
    left: var(--circle-container-offset);
    top: var(--circle-container-offset);
    border-radius: var(--container-radius);
    -webkit-box-shadow: inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), 0 0 0 0.625em rgba(255, 255, 255, 0.1), 0 0 0 1.25em rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), inset 0 0 0 3.375em rgba(255, 255, 255, 0.1), 0 0 0 0.625em rgba(255, 255, 255, 0.1), 0 0 0 1.25em rgba(255, 255, 255, 0.1);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-transition: var(--circle-transition);
    -o-transition: var(--circle-transition);
    transition: var(--circle-transition);
    pointer-events: none;
}

.theme-switch__sun-moon-container {
    pointer-events: auto;
    position: relative;
    z-index: 2;
    width: var(--sun-moon-diameter);
    height: var(--sun-moon-diameter);
    margin: auto;
    border-radius: var(--container-radius);
    background-color: var(--sun-bg);
    -webkit-box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #a1872a inset;
    box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #a1872a inset;
    -webkit-filter: drop-shadow(0.062em 0.125em 0.125em rgba(0, 0, 0, 0.25)) drop-shadow(0em 0.062em 0.125em rgba(0, 0, 0, 0.25));
    filter: drop-shadow(0.062em 0.125em 0.125em rgba(0, 0, 0, 0.25)) drop-shadow(0em 0.062em 0.125em rgba(0, 0, 0, 0.25));
    overflow: hidden;
    -webkit-transition: var(--transition);
    -o-transition: var(--transition);
    transition: var(--transition);
}

.theme-switch__moon {
    -webkit-transform: translateX(100%);
    -ms-transform: translateX(100%);
    transform: translateX(100%);
    width: 100%;
    height: 100%;
    background-color: var(--moon-bg);
    border-radius: inherit;
    -webkit-box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #969696 inset;
    box-shadow: 0.062em 0.062em 0.062em 0em rgba(254, 255, 239, 0.61) inset, 0em -0.062em 0.062em 0em #969696 inset;
    -webkit-transition: var(--transition);
    -o-transition: var(--transition);
    transition: var(--transition);
    position: relative;
}

.theme-switch__spot {
    position: absolute;
    top: 0.75em;
    left: 0.312em;
    width: 0.75em;
    height: 0.75em;
    border-radius: var(--container-radius);
    background-color: var(--spot-color);
    -webkit-box-shadow: 0em 0.0312em 0.062em rgba(0, 0, 0, 0.25) inset;
    box-shadow: 0em 0.0312em 0.062em rgba(0, 0, 0, 0.25) inset;
}

.theme-switch__spot:nth-of-type(2) {
    width: 0.375em;
    height: 0.375em;
    top: 0.937em;
    left: 1.375em;
}

.theme-switch__spot:nth-last-of-type(3) {
    width: 0.25em;
    height: 0.25em;
    top: 0.312em;
    left: 0.812em;
}

.theme-switch__clouds {
    width: 1.25em;
    height: 1.25em;
    background-color: var(--clouds-color);
    border-radius: var(--container-radius);
    position: absolute;
    bottom: -0.625em;
    left: 0.312em;
    -webkit-box-shadow: 0.937em 0.312em var(--clouds-color), -0.312em -0.312em var(--back-clouds-color), 1.437em 0.375em var(--clouds-color), 0.5em -0.125em var(--back-clouds-color), 2.187em 0 var(--clouds-color), 1.25em -0.062em var(--back-clouds-color), 2.937em 0.312em var(--clouds-color), 2em -0.312em var(--back-clouds-color), 3.625em -0.062em var(--clouds-color), 2.625em 0em var(--back-clouds-color), 4.5em -0.312em var(--clouds-color), 3.375em -0.437em var(--back-clouds-color), 4.625em -1.75em 0 0.437em var(--clouds-color), 4em -0.625em var(--back-clouds-color), 4.125em -2.125em 0 0.437em var(--back-clouds-color);
    box-shadow: 0.937em 0.312em var(--clouds-color), -0.312em -0.312em var(--back-clouds-color), 1.437em 0.375em var(--clouds-color), 0.5em -0.125em var(--back-clouds-color), 2.187em 0 var(--clouds-color), 1.25em -0.062em var(--back-clouds-color), 2.937em 0.312em var(--clouds-color), 2em -0.312em var(--back-clouds-color), 3.625em -0.062em var(--clouds-color), 2.625em 0em var(--back-clouds-color), 4.5em -0.312em var(--clouds-color), 3.375em -0.437em var(--back-clouds-color), 4.625em -1.75em 0 0.437em var(--clouds-color), 4em -0.625em var(--back-clouds-color), 4.125em -2.125em 0 0.437em var(--back-clouds-color);
    -webkit-transition: 0.5s cubic-bezier(0, -0.02, 0.4, 1.25);
    -o-transition: 0.5s cubic-bezier(0, -0.02, 0.4, 1.25);
    transition: 0.5s cubic-bezier(0, -0.02, 0.4, 1.25);
}

.theme-switch__stars-container {
    position: absolute;
    color: var(--stars-color);
    top: -100%;
    left: 0.312em;
    width: 2.75em;
    height: auto;
    -webkit-transition: var(--transition);
    -o-transition: var(--transition);
    transition: var(--transition);
}

/* Actions */
.theme-switch__checkbox:checked + .theme-switch__container {
    background-color: var(--container-night-bg);
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__circle-container {
    left: calc(100% - var(--circle-container-offset) - var(--circle-container-diameter));
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__circle-container:hover {
    left: calc(100% - var(--circle-container-offset) - var(--circle-container-diameter) - 0.187em);
}

.theme-switch__circle-container:hover {
    left: calc(var(--circle-container-offset) + 0.187em);
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__moon {
    -webkit-transform: translate(0);
    -ms-transform: translate(0);
    transform: translate(0);
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__clouds {
    bottom: -4.062em;
}

.theme-switch__checkbox:checked + .theme-switch__container .theme-switch__stars-container {
    top: 50%;
    -webkit-transform: translateY(-50%);
    -ms-transform: translateY(-50%);
    transform: translateY(-50%);
}

/* Old simple switch - keeping for backwards compatibility */
.switch {
    font-size: 17px;
    position: relative;
    display: inline-block;
    width: 3.5em;
    height: 2em;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    --background: #28096b;
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--background);
    transition: .5s;
    border-radius: 30px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 1.4em;
    width: 1.4em;
    border-radius: 50%;
    left: 10%;
    bottom: 15%;
    box-shadow: inset 8px -4px 0px 0px #fff000;
    background: var(--background);
    transition: .5s;
}

input:checked + .slider {
    background-color: #522ba7;
}

input:checked + .slider:before {
    transform: translateX(100%);
    box-shadow: inset 15px -4px 0px 15px #fff000;
}

/* Old theme toggle button styles - keeping for backwards compatibility */
#themeToggle {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 12px;
    box-shadow: var(--shadow-1);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
}

#themeToggle:hover {
    background: var(--surface-2);
    box-shadow: var(--shadow-2);
    transform: scale(1.05);
}

/* Logo dark mode support */
.logo-light {
    display: none;
}

:root[data-theme="dark"] .logo-dark {
    display: none;
}

:root[data-theme="dark"] .logo-light {
    display: inline-block;
}

/* Invert logos in dark mode if no light version available */
:root[data-theme="dark"] .logo-img:not(.logo-light):not(.logo-no-invert) {
    filter: brightness(0) invert(1);
}

/* Manager/Reporting Panel specific styles */
.page-header,
.content-header {
    background: var(--primary-gradient);
}

.content-header h1,
.content-header .subtitle {
    color: white !important;
}

.back-btn {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.page-content {
    background: var(--bg);
}

.tool-btn {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-2);
}

.tool-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tool-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: var(--primary);
}

.user-filter,
.date-range {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.metrics-dashboard,
.charts-section {
    background: transparent;
}

.metric-card,
.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-2);
}

.metric-card:hover,
.chart-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.metric-title {
    color: var(--text-2);
}

.metric-value {
    color: var(--text);
}

.metric-label {
    color: var(--text-muted);
}

.chart-title {
    color: var(--text);
}

.runs-table-container {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-1);
}

.runs-table {
    background: var(--surface);
}

.runs-table th {
    background: var(--surface-2);
    color: var(--text);
    border-bottom-color: var(--border);
}

.runs-table td {
    border-bottom-color: var(--border);
    color: var(--text);
}

.runs-table tr:hover {
    background: var(--surface-2);
}

.load-more-btn {
    background: var(--primary);
    color: white;
}

.load-more-btn:hover {
    background: var(--primary-hover);
}

.load-more-btn:disabled {
    background: var(--border);
}

/* Spinner */
.spinner {
    border-color: var(--border);
    border-top-color: var(--primary);
}

/* Empty state */
.empty-state {
    color: var(--text-muted);
}

/* Access denied modal */
.modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background: var(--surface);
    box-shadow: var(--shadow-hover);
}

.modal-content h2 {
    color: var(--text);
}

.modal-content p {
    color: var(--text-2);
}

.modal-btn {
    background: var(--primary-gradient);
    box-shadow: 0 4px 15px var(--focus-ring);
}

.modal-btn:hover {
    background: var(--primary-hover);
}
