/* ========================================
   Orchestrate — Attune Design System
   ======================================== */

:root {
    /* Brand */
    --coral: #E07A5F;
    --coral-light: #F5D0C5;
    --coral-dark: #B8533A;
    --teal: #0E8585;
    --teal-light: #C2E3E3;
    --teal-dark: #0A5C5C;
    --violet: #7B68A6;
    --violet-light: #D5CEE5;
    --violet-dark: #564A7A;

    /* Semantic */
    --warning: #D4943A;
    --error: #DC4444;

    /* Neutrals (Slate) */
    --slate-950: #0F172A;
    --slate-900: #1E293B;
    --slate-800: #283D52;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748B;
    --slate-400: #94A3B8;
    --slate-300: #CBD5E1;
    --slate-200: #E2E8F0;
    --slate-100: #F1F5F9;
    --warm-white: #FAFAF7;

    /* Archetype colors */
    --arch-executing: #009E73;
    --arch-intellectual: #0072B2;
    --arch-relating: #E69F00;
    --arch-influencing: #7E2954;

    /* Gradients */
    --gradient-full: linear-gradient(135deg, #E07A5F, #0E8585, #7B68A6);

    /* Typography */
    --font-heading: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-pill: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 2px 8px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 4px 16px rgba(15, 23, 42, 0.1);

    /* Layout */
    --sidebar-width: 260px;
}


/* ---- Reset & Base ---- */

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

html, body {
    height: 100%;
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    color: var(--slate-900);
    background: var(--warm-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--slate-950);
}

h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }

a {
    color: var(--teal);
    text-decoration: none;
}
a:hover {
    color: var(--teal-dark);
}


/* ---- App Shell ---- */

.app-shell {
    display: flex;
    height: 100vh;
}


/* ---- Sidebar ---- */

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--slate-950);
    display: flex;
    flex-direction: column;
    color: var(--slate-300);
}

.sidebar-gradient-bar {
    height: 3px;
    background: var(--gradient-full);
    flex-shrink: 0;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    flex-shrink: 0;
}

.brand-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.125rem;
    color: #fff;
    letter-spacing: -0.01em;
}

.sidebar-nav {
    flex: 1;
    padding: 0 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    color: var(--slate-400);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 150ms, color 150ms;
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--slate-200);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-icon {
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active .nav-icon {
    opacity: 1;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-pill);
    background: var(--teal);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--slate-200);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.6875rem;
    color: var(--slate-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--slate-500);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color 150ms, background 150ms;
    flex-shrink: 0;
}

.logout-btn:hover {
    color: var(--slate-300);
    background: rgba(255, 255, 255, 0.06);
}


/* ---- Main Content ---- */

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px;
    background: var(--warm-white);
}

.page-header {
    margin-bottom: 32px;
}

.page-subtitle {
    color: var(--slate-500);
    margin-top: 4px;
}


/* ---- Cards ---- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.card {
    background: #fff;
    border: 1px solid rgba(30, 41, 59, 0.12);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.card h3 {
    margin-bottom: 8px;
}

.card p {
    color: var(--slate-600);
    font-size: 0.875rem;
    line-height: 1.5;
}

.card-badge {
    display: inline-block;
    margin-top: 16px;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-pill);
    background: var(--slate-100);
    color: var(--slate-500);
}


/* ---- Login Page ---- */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--slate-100);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-full);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: var(--slate-500);
    margin-top: 6px;
    font-size: 0.875rem;
}


/* ---- Forms ---- */

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

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--slate-700);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--slate-900);
    background: #fff;
    transition: border-color 150ms, box-shadow 150ms;
}

.form-input::placeholder {
    color: var(--slate-400);
}

.form-input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(14, 133, 133, 0.12);
}

.form-error {
    padding: 10px 14px;
    margin-bottom: 20px;
    border-radius: var(--radius-md);
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: var(--error);
    font-size: 0.8125rem;
}


/* ---- Buttons ---- */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 38px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--teal);
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 150ms;
}

.btn-primary:hover {
    background: var(--teal-dark);
    color: #fff;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-inline {
    width: auto;
    padding: 0 20px;
    white-space: nowrap;
}

.btn-secondary {
    height: 38px;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--slate-700);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 150ms, border-color 150ms;
    padding: 0 20px;
}

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

.btn-danger {
    height: 38px;
    border: 1px solid #FECACA;
    border-radius: var(--radius-md);
    background: #FEF2F2;
    color: var(--error);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 150ms;
    padding: 0 20px;
}

.btn-danger:hover {
    background: #FEE2E2;
}

.btn-icon {
    background: none;
    border: none;
    padding: 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--slate-400);
    transition: color 150ms, background 150ms;
    display: inline-flex;
    align-items: center;
}

.btn-danger-icon:hover {
    color: var(--error);
    background: #FEF2F2;
}


/* ---- Page Header ---- */

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.page-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.breadcrumb-link {
    font-size: 0.8125rem;
    color: var(--slate-500);
    margin-bottom: 4px;
    display: inline-block;
}

.breadcrumb-link:hover {
    color: var(--teal);
}

.text-muted {
    color: var(--slate-500);
    font-size: 0.875rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: var(--radius-pill);
    background: var(--slate-200);
    color: var(--slate-600);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
}


/* ---- Cards (extended) ---- */

.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 150ms, border-color 150ms;
}

.card-link:hover {
    border-color: var(--teal-light);
    box-shadow: var(--shadow-md);
    color: inherit;
}

.section-card {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 1.125rem;
}


/* ---- Forms (extended) ---- */

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-textarea {
    height: auto;
    padding: 10px 12px;
    resize: vertical;
    min-height: 70px;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}


/* ---- Workshop List ---- */

.workshop-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.workshop-card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 150ms, border-color 150ms;
}

.workshop-card:hover {
    border-color: var(--teal-light);
    box-shadow: var(--shadow-md);
    color: inherit;
}

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

.workshop-date {
    font-size: 0.8125rem;
    color: var(--slate-500);
    white-space: nowrap;
    font-family: var(--font-mono);
}

.workshop-customer {
    color: var(--slate-600);
    font-size: 0.875rem;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--slate-500);
}


/* ---- Upload Panel ---- */

.upload-panel {
    margin-bottom: 16px;
}

.upload-zone {
    display: block;
    border: 2px dashed var(--slate-300);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    transition: border-color 150ms, background 150ms;
    position: relative;
    cursor: pointer;
}

.upload-zone:hover {
    border-color: var(--teal);
    background: rgba(14, 133, 133, 0.04);
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.upload-hint {
    color: var(--slate-500);
    font-size: 0.875rem;
    pointer-events: none;
}

.upload-hint-sub {
    font-size: 0.75rem;
    color: var(--slate-400);
    margin-top: 4px;
}

.upload-results {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upload-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    background: var(--slate-100);
}

.upload-result.success {
    background: #ECFDF5;
    color: #065F46;
}

.upload-result.error {
    background: #FEF2F2;
    color: var(--error);
}

.upload-result.parsing {
    background: #FFFBEB;
    color: var(--warning);
}

.upload-result-file {
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-result-status {
    flex-shrink: 0;
    margin-left: 12px;
}


/* ---- Participant Table ---- */

.participant-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin-top: 16px;
}

.participant-table th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 12px;
    border-bottom: 1px solid var(--slate-200);
}

.participant-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--slate-100);
    font-size: 0.875rem;
}

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

.participant-name {
    width: 200px;
    font-weight: 500;
    white-space: nowrap;
}

.participant-talents {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.participant-actions {
    text-align: right;
    width: 48px;
}


/* ---- Order Column ---- */

.col-order {
    width: 44px;
    text-align: center;
}

.order-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.btn-order {
    padding: 1px;
    color: var(--slate-400);
}

.btn-order:hover:not(:disabled) {
    color: var(--teal);
    background: rgba(14, 133, 133, 0.08);
}

.btn-order:disabled {
    opacity: 0.25;
    cursor: default;
}


/* ---- Pinned Row ---- */

.participant-pinned td:first-child {
    position: relative;
}

.participant-pinned td:first-child::before {
    content: "";
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    border-radius: 2px;
    background: var(--teal);
}


/* ---- Inline Name Edit ---- */

.participant-name-text {
    cursor: pointer;
    border-bottom: 1px dashed transparent;
    transition: border-color 150ms;
}

.participant-name-text:hover {
    border-bottom-color: var(--slate-300);
}

.inline-edit {
    display: flex;
    align-items: center;
    gap: 6px;
}

.inline-edit-input {
    width: 100px;
    height: 30px;
    padding: 0 8px;
    font-size: 0.8125rem;
}

.btn-save-icon:hover {
    color: var(--teal);
    background: rgba(14, 133, 133, 0.08);
}


/* ---- Talent Chips ---- */

.talent-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.6875rem;
    font-weight: 500;
    white-space: nowrap;
}

.talent-chip.executing {
    background: rgba(0, 158, 115, 0.12);
    color: #006B4F;
}

.talent-chip.intellectual {
    background: rgba(0, 114, 178, 0.12);
    color: #004A73;
}

.talent-chip.relating {
    background: rgba(230, 159, 0, 0.12);
    color: #8B6000;
}

.talent-chip.influencing {
    background: rgba(126, 41, 84, 0.12);
    color: #5E1F42;
}


/* ---- Teams ---- */

.team-create-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.team-create-row .form-input {
    flex: 1;
    max-width: 300px;
}

.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.team-card {
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 16px;
}

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

.team-card-header h4 {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9375rem;
}

.team-members {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-member-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--slate-700);
    cursor: pointer;
}

.team-member-check input[type="checkbox"] {
    accent-color: var(--teal);
    width: 16px;
    height: 16px;
}


/* ---- Utilities ---- */

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid var(--error);
}

.validation-message {
    color: var(--error);
}


/* ---- Blazor Error UI ---- */

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    background: #b32121;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}
