/* Base Styles & Variables */
:root {
    --primary: #4361ee;
    --primary-dark: #3a0ca3;
    --secondary: #3f37c9;
    --accent: #4895ef;
    --light: #f8f9fa;
    --dark: #212529;
    --success: #4cc9f0;
    --warning: #f72585;
    --info: #560bad;
    --text: #495057;
    --text-light: #6c757d;
    --bg: #f5f7fa;
    --panel-bg: #ffffff;
    --border: #e9ecef;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --button-width: 150px;
    --button-height: 48px;
    --focus-ring: 0 0 0 3px rgba(67, 97, 238, 0.3);
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    min-height: 100vh;
    font-size: 16px;
}

/* Layout */
.container {
    display: grid;
    grid-template-areas:
        "header"
        "controls"
        "main"
        "info"
        "data"
        "help";
    gap: 1.5rem;
    max-width: 1800px;
    margin: 0 auto;
    padding: 1rem;
}

@media (min-width: var(--breakpoint-md)) {
    .container {
        padding: 2rem;
        gap: 2rem;
    }
}

header {
    grid-area: header;
    text-align: center;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

@media (min-width: var(--breakpoint-md)) {
    header {
        padding: 1.5rem;
    }
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: 0.5px;
}

@media (min-width: var(--breakpoint-md)) {
    header h1 {
        font-size: 2.75rem;
        margin-bottom: 0.5rem;
    }
}

header p {
    font-size: 1rem;
    opacity: 0.9;
}

@media (min-width: var(--breakpoint-md)) {
    header p {
        font-size: 1.25rem;
    }
}

.control-panel {
    grid-area: controls;
    background: var(--panel-bg);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

@media (min-width: var(--breakpoint-md)) {
    .control-panel {
        padding: 2rem;
    }
}

.main-grid {
    grid-area: main;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: var(--breakpoint-lg)) {
    .main-grid {
        grid-template-columns: 2fr 1fr;
        gap: 2rem;
    }
}

.visualization-panel {
    background: var(--panel-bg);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    min-height: 350px;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

@media (min-width: var(--breakpoint-md)) {
    .visualization-panel {
        padding: 2rem;
        min-height: 500px;
    }
}

.side-panels {
    display: grid;
    grid-template-rows: auto auto;
    gap: 1.5rem;
}

.info-grid {
    grid-area: info;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: var(--breakpoint-md)) {
    .info-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

.data-panel, .help-panel {
    background: var(--panel-bg);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

@media (min-width: var(--breakpoint-md)) {
    .data-panel, .help-panel {
        padding: 2rem;
    }
}

/* Components */
.control-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: var(--breakpoint-md)) {
    .control-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
        margin-bottom: 2rem;
    }
}

.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.button-group.right {
    justify-content: center;
}

@media (min-width: var(--breakpoint-md)) {
    .button-group.right {
        justify-content: flex-end;
    }
}

button, label[for="upload"] {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    box-shadow: var(--shadow);
    min-width: fit-content;
    justify-content: center;
    flex: 1;
}

@media (min-width: var(--breakpoint-md)) {
    button, label[for="upload"] {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
        gap: 0.75rem;
        flex: none;
    }
}

button:hover, label[for="upload"]:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

button:active, label[for="upload"]:active {
    transform: translateY(0);
    box-shadow: var(--shadow);
}

button:disabled {
    background-color: var(--text-light);
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

button i {
    font-size: 0.9rem;
}

@media (min-width: var(--breakpoint-md)) {
    button i {
        font-size: 1rem;
    }
}

input[type="file"] {
    display: none;
}

select, input[type="number"], input[type="range"] {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background-color: var(--panel-bg);
    transition: var(--transition);
    font-size: 0.9rem;
    color: var(--text);
}

@media (min-width: var(--breakpoint-md)) {
    select, input[type="number"], input[type="range"] {
        padding: 0.75rem;
        font-size: 1rem;
    }
}

select:focus, input[type="number"]:focus, input[type="range"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}

#input-config {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: var(--breakpoint-md)) {
    #input-config {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 1.5rem;
    }
}

#input-selectors {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: var(--breakpoint-md)) {
    #input-selectors {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 1.5rem;
    }
}

.viz-config {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: var(--breakpoint-md)) {
    .viz-config {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 1.5rem;
    }
}

.status {
    background: var(--light);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    width: 100%;
}

@media (min-width: var(--breakpoint-md)) {
    .status {
        padding: 1rem 1.5rem;
        font-size: 0.95rem;
        width: auto;
    }
}

.status p {
    margin: 0.5rem 0;
}

.panel-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: var(--breakpoint-md)) {
    .panel-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 2rem;
        flex-wrap: wrap;
        gap: 1.5rem;
    }
}

.panel-header h2 {
    font-size: 1.5rem;
    color: var(--dark);
    font-weight: 600;
}

@media (min-width: var(--breakpoint-md)) {
    .panel-header h2 {
        font-size: 1.75rem;
    }
}

.params-panel, .metrics-panel, .explanation-panel, .code-panel {
    background: var(--panel-bg);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

@media (min-width: var(--breakpoint-md)) {
    .params-panel, .metrics-panel, .explanation-panel, .code-panel {
        padding: 2rem;
    }
}

.params-panel h3, .metrics-panel h3, .explanation-panel h3, .code-panel h3 {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
    color: var(--dark);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (min-width: var(--breakpoint-md)) {
    .params-panel h3, .metrics-panel h3, .explanation-panel h3, .code-panel h3 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
        gap: 0.75rem;
    }
}

.params-panel h3 i, .metrics-panel h3 i, .explanation-panel h3 i, .code-panel h3 i {
    color: var(--accent);
    font-size: 1.1rem;
}

@media (min-width: var(--breakpoint-md)) {
    .params-panel h3 i, .metrics-panel h3 i, .explanation-panel h3 i, .code-panel h3 i {
        font-size: 1.25rem;
    }
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary);
}

#visualization, #plotly-viz {
    width: 100%;
    flex-grow: 1;
    background-color: var(--panel-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
}

.hidden {
    display: none;
}

#metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

@media (min-width: var(--breakpoint-md)) {
    #metrics {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 1.5rem;
    }
}

.metric {
    background: var(--light);
    padding: 1rem;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

@media (min-width: var(--breakpoint-md)) {
    .metric {
        padding: 1.25rem;
    }
}

.metric h4 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

@media (min-width: var(--breakpoint-md)) {
    .metric h4 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
}

.metric p {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
}

@media (min-width: var(--breakpoint-md)) {
    .metric p {
        font-size: 1.5rem;
    }
}

#explanation {
    line-height: 1.6;
    font-size: 0.95rem;
}

@media (min-width: var(--breakpoint-md)) {
    #explanation {
        line-height: 1.8;
        font-size: 1rem;
    }
}

#explanation ul, .help-panel ul {
    padding-left: 1.5rem;
    margin: 0.75rem 0;
}

@media (min-width: var(--breakpoint-md)) {
    #explanation ul, .help-panel ul {
        padding-left: 2rem;
        margin: 1rem 0;
    }
}

#explanation li, .help-panel li {
    margin-bottom: 0.5rem;
}

@media (min-width: var(--breakpoint-md)) {
    #explanation li, .help-panel li {
        margin-bottom: 0.75rem;
    }
}

#code {
    background: var(--dark);
    color: #f8f8f2;
    padding: 1.25rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

@media (min-width: var(--breakpoint-md)) {
    #code {
        padding: 1.5rem;
        font-size: 0.95rem;
        line-height: 1.6;
    }
}

#data-preview {
    overflow-x: auto;
    margin-top: 1.25rem;
}

@media (min-width: var(--breakpoint-md)) {
    #data-preview {
        margin-top: 1.5rem;
    }
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
}

@media (min-width: var(--breakpoint-md)) {
    table {
        font-size: 0.95rem;
    }
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

@media (min-width: var(--breakpoint-md)) {
    th, td {
        padding: 1rem;
    }
}

th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr:hover {
    background-color: #f1f1f1;
    transition: background-color 0.2s ease;
}

/* Tooltip */
.tooltip {
    position: absolute;
    padding: 0.75rem 1.25rem;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    border-radius: 6px;
    pointer-events: none;
    font-size: 0.9rem;
    z-index: 100;
    box-shadow: var(--shadow);
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.visualization-panel, .params-panel, .metrics-panel, .explanation-panel, .code-panel, .data-panel, .help-panel {
    animation: fadeIn 0.4s ease-out;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

@media (min-width: var(--breakpoint-md)) {
    ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }
}

::-webkit-scrollbar-track {
    background: var(--light);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
    border: 2px solid var(--light);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Ripple Effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.7);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Theme Toggle */
.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    transition: var(--transition);
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius);
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow);
}

@media (min-width: var(--breakpoint-md)) {
    .theme-toggle {
        top: 1.5rem;
        right: 1.5rem;
        padding: 0.75rem 1.5rem;
    }
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-hover);
}

/* Dark Theme Adjustments */
.dark-theme {
    --bg: #121212;
    --panel-bg: #1e1e1e;
    --border: #343a40;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.4);
    --code-bg: #1e1e1e;
    --text: #e9ecef;
    --text-light: #adb5bd;
    --primary: #4895ef;
    --primary-dark: #4361ee;
    --accent: #4cc9f0;
    --light: #212529;
    --dark: #f8f9fa;
}

.dark-theme .visualization-panel,
.dark-theme .params-panel,
.dark-theme .metrics-panel,
.dark-theme .explanation-panel,
.dark-theme .code-panel,
.dark-theme .data-panel,
.dark-theme .help-panel {
    border: 1px solid var(--border);
}

.dark-theme #code {
    border: 1px solid var(--border);
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.05);
}

.dark-theme table {
    color: var(--text);
}

.dark-theme th {
    background-color: var(--primary-dark);
}

.dark-theme tr:nth-child(even) {
    background-color: #2a2a2a;
}

.dark-theme tr:hover {
    background-color: #333333;
}

/* Collapsible Panels */
.collapse-toggle {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    margin-left: 0.5rem;
    padding: 0.3rem;
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

@media (min-width: var(--breakpoint-md)) {
    .collapse-toggle {
        margin-left: 0.75rem;
        font-size: 1.25rem;
    }
}

.collapsed {
    display: none;
}

/* Labels and Inputs */
.control-grid label, #input-config label, #input-selectors label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.4rem;
}

@media (min-width: var(--breakpoint-md)) {
    .control-grid label, #input-config label, #input-selectors label {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
}

input[type="range"] {
    accent-color: var(--primary);
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    background: var(--primary);
    border-radius: 50%;
    border: 2px solid var(--panel-bg);
}

/* Focus States */
button:focus, select:focus, input:focus {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Hover and Active States */
.params-panel:hover, .metrics-panel:hover, .explanation-panel:hover, .code-panel:hover, .data-panel:hover, .help-panel:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

/* Pulse Animation for processing status */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

.pulse {
    animation: pulse 1.5s infinite ease-in-out;
}

/* Error message styling */
.error-message {
    color: var(--warning);
    padding: 1rem;
    background-color: rgba(247, 37, 133, 0.1);
    border-left: 4px solid var(--warning);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.error {
    background-color: rgba(247, 37, 133, 0.1) !important;
    color: var(--warning) !important;
    border-left: 4px solid var(--warning) !important;
}

/* SaaS Features */
/* User Profile Dropdown */
.user-profile {
    position: relative;
    display: inline-block;
}

.profile-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.profile-button:hover {
    background-color: var(--light);
}

.profile-button img {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    object-fit: cover;
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    min-width: 200px;
    box-shadow: var(--shadow);
    z-index: 100;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.3s ease;
}

.profile-dropdown.show {
    opacity: 1;
    transform: translateY(10px);
    pointer-events: auto;
}

.profile-dropdown ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.profile-dropdown li {
    padding: 0;
    margin: 0;
}

.profile-dropdown a, .profile-dropdown button {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text);
    text-decoration: none;
    text-align: left;
    background: none;
    border: none;
    width: 100%;
    font-weight: normal;
    box-shadow: none;
    transition: var(--transition);
}

.profile-dropdown a:hover, .profile-dropdown button:hover {
    background-color: var(--light);
    transform: none;
    box-shadow: none;
}

.profile-dropdown hr {
    margin: 0.5rem 0;
    border: none;
    border-top: 1px solid var(--border);
}

/* Dashboard Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: var(--breakpoint-lg)) {
    .dashboard-grid {
        grid-template-columns: 240px 1fr;
        gap: 2rem;
    }
}

.sidebar-nav {
    background-color: var(--panel-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    height: fit-content;
}

.sidebar-nav h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 0.75rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

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

.sidebar-nav a i {
    font-size: 1.1rem;
    color: var(--primary);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 9999;
}

.toast {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    max-width: 450px;
    padding: 1rem 1.5rem;
    background-color: var(--panel-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    transform: translateX(120%);
    animation: slideIn 0.3s forwards, fadeOut 0.3s 3.7s forwards;
}

.toast i {
    font-size: 1.5rem;
}

.toast.success i {
    color: var(--success);
}

.toast.error i {
    color: var(--warning);
}

.toast.info i {
    color: var(--info);
}

.toast-content {
    flex: 1;
}

.toast-content h4 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
    font-weight: 600;
}

.toast-content p {
    font-size: 0.9rem;
    color: var(--text-light);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

.toast-close:hover {
    color: var(--text);
    background: none;
    transform: none;
    box-shadow: none;
}

@keyframes slideIn {
    to {
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* Project History */
.history-item {
    padding: 1.25rem;
    background-color: var(--panel-bg);
    border-radius: var(--border-radius);
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-left: 4px solid var(--primary);
}

.history-item:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

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

.history-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
}

.history-date {
    font-size: 0.85rem;
    color: var(--text-light);
}

.history-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 20px;
    background-color: var(--light);
    color: var(--text);
}

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

.badge.secondary {
    background-color: var(--secondary);
    color: white;
}

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

.history-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.history-metric {
    text-align: center;
}

.history-metric span {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.history-metric strong {
    font-size: 1.1rem;
    color: var(--primary);
}

.history-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1rem;
}

/* Team Collaboration */
.team-members {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1.5rem 0;
}

.team-member {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.team-member img {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--panel-bg);
    box-shadow: var(--shadow);
}

.team-member span {
    font-size: 0.9rem;
    font-weight: 500;
}

.team-member.add {
    justify-content: center;
}

.team-member.add button {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light);
    color: var(--text);
    border: 2px dashed var(--border);
    box-shadow: none;
}

.team-member.add button:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Modal Dialog */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-dialog {
    background-color: var(--panel-bg);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-hover);
    transform: translateY(-30px);
    transition: transform 0.3s ease;
}

.modal-backdrop.show .modal-dialog {
    transform: translateY(0);
}

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    margin: 0;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
}

.modal-close:hover {
    color: var(--warning);
    background: none;
    transform: none;
    box-shadow: none;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}