/* RACI Chart Specific Styles - Matched to Scorecard/Dark Theme */

:root {
    /* Scorecard Theme Variables */
    --raci-bg: rgba(24, 24, 27, 0.4);
    --raci-header-bg: rgba(24, 24, 27, 0.95);
    --raci-border: rgba(255, 255, 255, 0.1);
    --raci-text-main: #f4f4f5;
    --raci-text-muted: #a1a1aa;
    --raci-accent: var(--theme-orange, #f97316);

    /* Value Colors */
    --color-R: #f87171;
    /* Red */
    --color-A: #fb923c;
    /* Orange */
    --color-C: #facc15;
    /* Yellow */
    --color-I: #60a5fa;
    /* Blue */
}

/* Main Container Override to match Scorecard wrapper */
.raci-wrapper {
    width: 100%;
    height: calc(100vh - 8rem);
    /* Max height within layout */
    overflow: hidden;
    /* Manage scroll internally */
    padding: 0;
    background: var(--raci-bg);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 1px solid var(--raci-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.raci-title {
    text-align: center;
    color: var(--raci-text-main);
    text-transform: uppercase;
    font-weight: 800;
    font-size: 1.5rem;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}

.raci-header-container {
    padding: 16px 24px;
    border-bottom: 1px solid var(--raci-border);
    background: rgba(15, 15, 17, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.raci-scroll-container {
    flex: 1;
    overflow: auto;
    position: relative;
}

/* Scrollbar styling */
.raci-scroll-container::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.raci-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.raci-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.raci-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.raci-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--raci-text-main);
}

.raci-table th,
.raci-table td {
    border-right: 1px solid var(--raci-border);
    border-bottom: 1px solid var(--raci-border);
    padding: 0;
    text-align: center;
    min-width: 120px;
    position: relative;
    height: 44px;
    /* Increased height for elegance */
}

/* Header Cells (Roles) */
.raci-table thead th {
    background: var(--raci-header-bg);
    color: var(--raci-text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.5rem;
    white-space: normal;
    vertical-align: middle;
    position: sticky;
    top: 0;
    z-index: 15;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: none;
    border-bottom: 1px solid var(--raci-accent);
    /* Accent underline for header */
}

.raci-table thead th:last-child {
    border-right: none;
}

/* Task Column (First Column) */
.raci-table tbody td:first-child {
    background: #18181b;
    color: #e4e4e7;
    text-align: left;
    font-weight: 500;
    min-width: 280px;
    padding: 0 1.5rem;
    position: sticky;
    left: 0;
    z-index: 10;
    border-right: 1px solid var(--raci-border);
    font-size: 0.9rem;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
}

/* Fix overlaps for Top-Left corner */
.raci-table thead th:first-child {
    background: var(--raci-header-bg);
    z-index: 20;
    left: 0;
    border-right: 1px solid var(--raci-border);
    font-size: 0.9rem;
    text-align: center;
    color: var(--raci-text-main);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
}

/* Regular Cells */
.raci-table tbody td:not(:first-child) {
    background-color: transparent;
    transition: background 0.15s;
}

/* Striping */
.raci-table tbody tr:nth-child(even) td:not(:first-child) {
    background-color: rgba(255, 255, 255, 0.015);
}

.raci-table tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

/* SELECT Styling */
.raci-select {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    color: inherit;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    display: block;
    padding: 0;
    opacity: 0.9;
}

.raci-select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.05);
}

/* Value Colors - Bright for dark theme */
.val-r .raci-select {
    color: var(--color-R);
}

.val-a .raci-select {
    color: var(--color-A);
}

.val-c .raci-select {
    color: var(--color-C);
}

.val-i .raci-select {
    color: var(--color-I);
}

.val-dot .raci-select {
    color: rgba(255, 255, 255, 0.2);
    /* More subtle dot */
    font-size: 1.5rem;
    line-height: 1;
}

/* Legend Styling - Compact at bottom */
.raci-legend {
    margin-top: auto;
    background: rgba(15, 15, 17, 0.9);
    padding: 12px 24px;
    border-top: 1px solid var(--raci-border);
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.raci-legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--raci-text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.raci-key {
    font-weight: 900;
    font-size: 1.1rem;
}

/* Controls */
.raci-controls {
    display: flex;
    gap: 1rem;
}

.raci-btn {
    background: rgba(255, 255, 255, 0.03);
    color: #e4e4e7;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(5px);
}

.raci-btn:hover {
    border-color: var(--raci-accent);
    color: white;
    background: var(--raci-accent);
    box-shadow: 0 0 10px rgba(var(--theme-primary-rgb, 249, 115, 22), 0.3);
}

/* Delete Handles */
.delete-handle {
    position: absolute;
    top: 50%;
    right: 8px;
    /* Slightly more inside */
    transform: translateY(-50%);
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

th:hover .delete-handle,
td:first-child:hover .delete-handle {
    opacity: 1;
}

.delete-handle:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.editable-header,
.editable-task {
    outline: none;
    width: 100%;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.editable-header:focus,
.editable-task:focus {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    box-shadow: 0 0 0 1px var(--raci-accent);
}