/* =============================================
   ICS Compute - CSAT Survey
   Clean & Simple Template
   ============================================= */

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

:root {
    --red: #E53030;
    --red-dark: #B91C1C;
    --red-light: #FEE2E2;
    --dark: #1a1a1a;
    --gray-900: #2d2d2d;
    --gray-600: #666;
    --gray-400: #999;
    --gray-200: #e5e5e5;
    --gray-100: #f5f5f5;
    --white: #ffffff;
    --green: #16a34a;
    --yellow: #ca8a04;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--white);
    border-bottom: 3px solid var(--red);
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    height: 40px;
    width: auto;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
}

/* Main */
.main {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 16px;
}

.main.dashboard {
    max-width: 1100px;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.hero-card {
    text-align: center;
    border-top: 4px solid var(--red);
}

.hero-card h1 {
    font-size: 1.6rem;
    color: var(--dark);
    margin-bottom: 4px;
}

.hero-card > p:first-of-type {
    color: var(--red);
    font-weight: 600;
    font-size: 1rem;
}

.divider {
    display: block;
    width: 40px;
    height: 3px;
    background: var(--red);
    margin: 16px auto;
    border-radius: 2px;
}

.hint {
    color: var(--gray-600);
    font-size: 0.9rem;
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--dark);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gray-200);
}

.card h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--dark);
}

/* Form Fields */
.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.req { color: var(--red); }

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    background: var(--white);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--red);
}

.field textarea { resize: vertical; }

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

/* Rating Stars */
.question {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.question:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.question p, .question-text {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--gray-900);
}

.stars {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

.stars label {
    cursor: pointer;
}

.stars input { display: none; }

.stars span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--gray-200);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: var(--white);
}

.stars label:hover span {
    border-color: var(--red);
    background: var(--red-light);
}

.stars input:checked ~ span,
.stars input:checked + span {
    background: var(--red);
    color: var(--white);
    border-color: var(--red);
}

.scale-hint {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* NPS */
.nps-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.nps-item { cursor: pointer; }
.nps-item input { display: none; }

.nps-item span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 6px;
    border: 1.5px solid var(--gray-200);
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.nps-item:hover span {
    border-color: var(--red);
    background: var(--red-light);
}

.nps-item input:checked + span {
    background: var(--red);
    color: var(--white);
    border-color: var(--red);
}

/* Buttons */
.actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 28px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-full { width: 100%; }

.btn-primary {
    background: var(--red);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--red-dark);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-600);
    border: 1.5px solid var(--gray-200);
}
.btn-secondary:hover {
    border-color: var(--gray-400);
}

.btn-success { background: var(--green); color: var(--white); }
.btn-success:hover { opacity: 0.9; }

.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: var(--red-dark); }

/* Success */
.success-card {
    text-align: center;
    padding: 48px 28px;
}

.success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--green);
    color: var(--white);
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.success-card h2 { border: none; padding: 0; margin-bottom: 8px; }
.success-card p { color: var(--gray-600); margin-bottom: 20px; }

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    font-size: 0.8rem;
    color: var(--gray-400);
    display: flex;
    justify-content: center;
    gap: 16px;
    align-items: center;
}

.footer a {
    color: var(--red);
    text-decoration: none;
    font-weight: 500;
}

/* =============================================
   LOGIN
   ============================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px 32px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border-top: 4px solid var(--red);
}

.login-box .logo { margin-bottom: 24px; }

.login-box h1 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--gray-600);
    font-size: 0.85rem;
    margin-bottom: 28px;
}

.login-box form { text-align: left; }

.pw-wrap {
    position: relative;
}
.pw-wrap input { width: 100%; padding-right: 40px; }
.pw-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
}
.pw-toggle:hover { opacity: 1; }

.alert-error {
    background: var(--red-light);
    color: var(--red-dark);
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 12px;
    text-align: center;
}

.back-link {
    display: inline-block;
    margin-top: 20px;
    color: var(--red);
    text-decoration: none;
    font-size: 0.85rem;
}

/* =============================================
   DASHBOARD
   ============================================= */
.page-title {
    font-size: 1.4rem;
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-left: 4px solid var(--red);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--gray-600);
}

/* Tables */
.simple-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.simple-table th,
.simple-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.simple-table th {
    font-weight: 600;
    color: var(--gray-600);
}

/* Bar charts */
.nps-bars { padding: 8px 0; }

.nps-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.nps-bar-row .nps-label {
    width: 120px;
    font-size: 0.8rem;
    font-weight: 500;
}

.bar-track {
    flex: 1;
    height: 20px;
    background: var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.4s;
}

.bar-fill.green { background: var(--green); }
.bar-fill.yellow { background: var(--yellow); }
.bar-fill.red { background: var(--red); }

.bar-pct {
    width: 36px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: right;
}

/* Category bar in table */
.cat-bar {
    height: 16px;
    background: var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    min-width: 80px;
}

.cat-bar-fill {
    height: 100%;
    background: var(--red);
    border-radius: 8px;
    transition: width 0.4s;
}

/* Filter */
.filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-row select,
.filter-row input {
    padding: 8px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.85rem;
}

/* Data Table */
.table-scroll { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    white-space: nowrap;
}

.data-table th,
.data-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-100);
    font-weight: 600;
    color: var(--gray-600);
}

.data-table tr:hover td { background: var(--gray-100); }

.btn-detail {
    background: var(--red);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
}

.btn-delete {
    background: var(--gray-600);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    margin-left: 4px;
}

.empty-state {
    text-align: center;
    padding: 32px;
    color: var(--gray-400);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
}

.modal h2 { margin-bottom: 16px; font-size: 1.1rem; }

.detail-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.85rem;
}

.detail-label {
    width: 140px;
    font-weight: 600;
    color: var(--gray-600);
    flex-shrink: 0;
}

.detail-value { color: var(--dark); }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 640px) {
    .grid-2 { grid-template-columns: 1fr; }
    .stars span { width: 36px; height: 36px; font-size: 0.8rem; }
    .nps-item span { width: 32px; height: 32px; font-size: 0.8rem; }
    .header-inner { flex-direction: column; gap: 8px; }
    .header-nav { flex-wrap: wrap; justify-content: center; }
    .filter-row { flex-direction: column; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .card { padding: 20px 16px; }
    .actions { flex-direction: column; }
    .btn-full, .actions .btn { width: 100%; }
}


/* =============================================
   USER MANAGEMENT & ROLE BADGES
   ============================================= */
.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-admin {
    background: var(--red-light);
    color: var(--red-dark);
}

.role-editor {
    background: #DBEAFE;
    color: #1E40AF;
}

.role-viewer {
    background: #F3F4F6;
    color: var(--gray-600);
}

.alert-success {
    background: #DCFCE7;
    color: #166534;
    padding: 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 12px;
    text-align: center;
}

/* User management table tweaks */
#usersTable td:nth-child(3) { text-align: center; }
#usersTable td:nth-child(5) { white-space: nowrap; }

/* Role info table checkmarks */
.simple-table td:nth-child(n+2) { text-align: center; }


/* Reset Password Button */
.btn-reset-pw {
    background: #ca8a04;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    margin-left: 4px;
}

.btn-reset-pw:hover {
    background: #a16207;
}


/* =============================================
   DETAIL MODAL - REDESIGNED
   ============================================= */
.detail-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.detail-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--red);
    margin-bottom: 14px;
}

/* Info Grid */
.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.detail-info-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--gray-100);
    border-radius: 8px;
}

.detail-info-icon {
    font-size: 1.2rem;
    line-height: 1;
    margin-top: 2px;
}

.detail-info-label {
    font-size: 0.7rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.detail-info-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
}

/* Rating Bars */
.detail-avg-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    border: 2px solid;
    border-radius: 12px;
    margin-bottom: 16px;
}

.detail-avg-number {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}

.detail-avg-label {
    font-size: 0.7rem;
    color: var(--gray-400);
    text-transform: uppercase;
    margin-top: 4px;
}

.detail-ratings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-rating-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-rating-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-rating-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--gray-900);
}

.detail-rating-score {
    font-size: 0.82rem;
    font-weight: 700;
}

.detail-rating-score small {
    font-weight: 400;
    color: var(--gray-600);
    margin-left: 4px;
}

.detail-rating-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.detail-rating-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* NPS Badge */
.detail-nps-badge {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    padding: 10px 20px;
    background: var(--gray-100);
    border-radius: 12px;
}

.detail-nps-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--dark);
}

.detail-nps-scale {
    font-size: 1rem;
    color: var(--gray-400);
    font-weight: 500;
}

/* Feedback */
.detail-feedback-item {
    margin-bottom: 14px;
}

.detail-feedback-item:last-child {
    margin-bottom: 0;
}

.detail-feedback-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.detail-feedback-text {
    font-size: 0.85rem;
    color: var(--gray-600);
    background: var(--gray-100);
    padding: 10px 14px;
    border-radius: 8px;
    line-height: 1.5;
    border-left: 3px solid var(--gray-200);
}

/* Modal wider for new design */
.modal {
    max-width: 620px;
}

@media (max-width: 640px) {
    .detail-info-grid {
        grid-template-columns: 1fr;
    }
}


/* Feedback cells in data table */
.feedback-cell {
    max-width: 150px;
    white-space: normal !important;
    font-size: 0.75rem;
    line-height: 1.3;
    text-align: left !important;
}


/* Filter enhancements */
.filter-note {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 14px;
}

.filter-mode {
    display: flex;
    gap: 20px;
    margin-bottom: 14px;
}

.filter-mode-opt {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--gray-900);
}

.filter-mode-opt input {
    accent-color: var(--red);
    cursor: pointer;
}

.filter-select {
    padding: 8px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: 6px;
    font-size: 0.85rem;
    background: var(--white);
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--red);
}
