:root {
    --bg-light: #ffffff;
    --bg-alt: #f8fafc;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(226, 232, 240, 1);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --success: #10b981;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: #ffffff;
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.5s ease;
    zoom: 0.8;
}

body.self-eval-mode {
    background-color: #e5e7eb;
    /* Distinct light grey */
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.view {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.view.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Glassmorphism */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: var(--card-shadow);
}

.login-card {
    max-width: 800px;
    margin: 4rem auto;
    text-align: center;
}

h1 {
    font-weight: 700;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #4f46e5, #9333ea);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

/* Grid for members */
.member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.5rem;
}

.member-card {
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.member-card:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent);
    transform: scale(1.05);
}

.member-initials {
    width: 48px;
    height: 48px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

/* Assessment View */
.assessment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    position: sticky;
    top: 2rem;
    z-index: 100;
    padding: 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow);
}

.header-content {
    flex: 1;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--accent), #c084fc);
    transition: width 0.5s ease;
}

/* Criteria */
.criteria-item {
    background: #fffbeb;
    /* Light yellow for peer eval */
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    margin-bottom: 0.75rem;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Override for Self-Eval (White boxes on Grey bg) */
body.self-eval-mode .criteria-item {
    background: white;
}

.criteria-item:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.criteria-info h3 {
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
}

.criteria-info p {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.criteria-info .it-desc {
    font-style: italic;
    opacity: 0.8;
    margin-top: 0.25rem;
}

/* Rating Scale */
.rating-scale {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.rating-btn {
    flex: 1;
    height: 38px;
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.rating-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.rating-btn.selected {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

/* Buttons */
.btn {
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

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

.primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.secondary {
    background: var(--bg-alt);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.danger {
    background: #ef4444;
    color: white;
}

.danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Admin Table */
.report-grid {
    display: block;
    /* Override grid for table */
    overflow-x: auto;
    background: white;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--glass-border);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.report-table th,
.report-table td {
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--glass-border);
}

.report-table th {
    background: var(--bg-alt);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.report-table tbody tr {
    transition: background 0.2s;
    cursor: pointer;
}

.report-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.member-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.member-initials-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
}

.member-name {
    font-weight: 600;
    color: var(--text-primary);
}

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge.pending {
    background: #f1f5f9;
    color: #64748b;
}

.badge.success {
    background: #dcfce7;
    color: #10b981;
}

.avg-score-small {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--accent);
}

.link-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn-small {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn-small:hover {
    background: var(--bg-alt);
    color: var(--accent);
}

.btn-small {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: white;
    border: 1px solid var(--glass-border);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-small:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Success View */
.central-card {
    max-width: 500px;
    margin: 8rem auto;
    text-align: center;
}

.success-icon {
    width: 64px;
    height: 64px;
    color: var(--success);
    margin-bottom: 2rem;
}

.notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 2rem;
    background: var(--accent);
    color: white;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    transform: translateY(100px);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.notification.show {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }

    .rating-scale {
        flex-wrap: wrap;
    }

    .rating-btn {
        flex: 1 0 18%;
    }
}

/* New Admin styles */
.glass-input {
    width: 100%;
    padding: 1rem;
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 2rem;
    outline: none;
    text-align: center;
}

.glass-input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
}

.view-toggle {
    opacity: 0.7;
    border: 1px solid var(--border);
}

.view-toggle.active {
    opacity: 1;
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Self-Eval Matrix Styles */
.matrix-container {
    overflow-x: auto;
    margin-top: 1rem;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.matrix-table th,
.matrix-table td {
    padding: 0.75rem 0.5rem;
    border: 1px solid var(--glass-border);
    text-align: center;
}

.matrix-table th {
    background: var(--bg-alt);
    font-weight: 600;
}

.matrix-table th.criteria-col {
    text-align: left;
    min-width: 250px;
    position: sticky;
    left: 0;
    background: var(--bg-alt);
    z-index: 10;
}

.matrix-table td.criteria-cell {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--bg-card);
    font-weight: 500;
}

.matrix-score {
    font-weight: 700;
    color: var(--accent);
}

.matrix-table tfoot td {
    background: var(--bg-alt);
    font-weight: 700;
    border-top: 2px solid var(--border);
}

.matrix-avg {
    color: var(--text-primary);
}

.matrix-table tfoot td {
    background: var(--bg-alt);
    font-weight: 700;
    border-top: 2px solid var(--border);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2.5rem;
    background: white;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    position: sticky;
    top: -2.5rem;
    background: white;
    padding: 1rem 0;
    margin-top: -2.5rem;
    z-index: 10;
    border-bottom: 1px solid var(--glass-border);
}

.detailed-criteria-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.detailed-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-alt);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

.detailed-item .info h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.detailed-item .info p {
    font-size: 0.8rem;
    margin: 0;
    opacity: 0.7;
}

.detailed-item .score {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
}

/* Evaluation Matrix Styles */
.matrix-eval-container {
    background: white;
    border-radius: 4px;
    /* More Excel-like */
    box-shadow: var(--card-shadow);
    border: 2px solid #000;
    overflow: auto;
    /* Both x and y */
    max-height: calc(100vh - 180px);
    /* Leave space for assessment header and padding */
    margin-bottom: 2rem;
}

.eval-matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    border: 2px solid #000;
}

.eval-matrix-table th,
.eval-matrix-table td {
    padding: 0.75rem;
    border: 1px solid #000;
    /* Black borders like Excel */
    text-align: center;
    min-width: 60px;
}

.eval-matrix-table th {
    background: #d1d5db;
    /* Gray background for headers */
    font-weight: 800;
    color: #000;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 30;
}

.eval-matrix-table th.criteria-col {
    text-align: left;
    min-width: 400px;
    position: sticky;
    left: 0;
    top: 0;
    z-index: 40;
    background: #d1d5db;
}

.eval-matrix-table td.criteria-cell {
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 10;
    font-weight: 500;
    background: inherit;
    /* Take background from TR */
}

/* Category Colors */
.row-header {
    background: #d1d5db !important;
    font-weight: 800;
}

.row-peach {
    background: #ffedd5 !important;
}

.row-tan {
    background: #fef3c7 !important;
}

.row-blue {
    background: #dbeafe !important;
}

.row-green {
    background: #dcfce7 !important;
}

.row-yellow {
    background: #fef9c3 !important;
}

.row-grey {
    background: #f3f4f6 !important;
}

/* Custom Select Styling */
.matrix-select {
    width: 100%;
    padding: 1px;
    border-radius: 4px;
    border: 1px solid #94a3b8;
    background: white;
    color: #000;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}

.matrix-select.rated {
    background-color: #fff;
    border-color: #10b981;
    color: #10b981;
}

.criteria-title {
    display: block;
    font-weight: 800;
    margin-bottom: 0.25rem;
    color: #000;
}

.criteria-desc {
    display: block;
    font-size: 0.8rem;
    color: #1e293b;
    line-height: 1.3;
}

.criteria-it {
    display: block;
    font-size: 0.8rem;
    font-style: italic;
    color: #334155;
    margin-top: 0.25rem;
}