@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* --- Core Theme Tokens & Reset --- */
:root {
    --bg-color: #0B0A14;
    --card-bg: rgba(20, 18, 38, 0.55);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-border-focus: rgba(139, 92, 246, 0.4);
    
    --primary: #8B5CF6;
    --primary-hover: #A78BFA;
    --primary-glow: rgba(139, 92, 246, 0.35);
    
    --secondary: #EC4899;
    --secondary-hover: #F472B6;
    
    --accent: #10B981;
    --accent-glow: rgba(16, 185, 129, 0.2);
    
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Cosmic background gradients */
body::before, body::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(150px);
    z-index: -1;
    opacity: 0.22;
    pointer-events: none;
}

body::before {
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    top: -10%;
    left: -10%;
    animation: floatingOrb1 20s infinite alternate ease-in-out;
}

body::after {
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
    bottom: -10%;
    right: -10%;
    animation: floatingOrb2 25s infinite alternate ease-in-out;
}

@keyframes floatingOrb1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(100px, 80px) scale(1.2); }
}

@keyframes floatingOrb2 {
    0% { transform: translate(0, 0) scale(1.1); }
    100% { transform: translate(-120px, -50px) scale(0.9); }
}

/* --- Layout --- */
.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    flex-grow: 1;
}

.dashboard-container {
    max-width: 1200px !important;
}

/* --- Card Styles --- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    margin-bottom: 24px;
    transition: var(--transition-smooth);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
}

/* --- Typography --- */
h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-title {
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, #FFFFFF 30%, var(--primary-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}

.header-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 40px;
    font-weight: 350;
}

.question-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.question-num {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #FFFFFF;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 0 15px var(--primary-glow);
}

/* --- Custom Inputs (Radio & Checkbox) --- */
.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 600px) {
    .options-grid.two-cols {
        grid-template-columns: 1fr 1fr;
    }
}

.option-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    cursor: pointer;
    transition: var(--transition-smooth);
    user-select: none;
}

.option-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Indicator structures */
.checkmark, .radio-dot {
    height: 20px;
    width: 20px;
    border: 2px solid var(--text-muted);
    margin-right: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-bounce);
    flex-shrink: 0;
}

.checkmark {
    border-radius: 6px;
}

.radio-dot {
    border-radius: 50%;
}

/* Selected state styling */
.option-item input:checked ~ .checkmark {
    border-color: var(--secondary);
    background: var(--secondary);
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.4);
}

.option-item input:checked ~ .radio-dot {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

.option-item input:checked ~ .radio-dot::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--primary-hover);
    border-radius: 50%;
    animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
}

.option-item input:checked ~ .checkmark::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid #FFFFFF;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
    animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.2) forwards;
}

.option-item input:checked {
    background: rgba(139, 92, 246, 0.08);
}

.option-item.selected-card {
    border-color: var(--card-border-focus);
    background: rgba(139, 92, 246, 0.06);
}

@keyframes popIn {
    0% { transform: scale(0) rotate(45deg); opacity: 0; }
    100% { transform: scale(1) rotate(45deg); opacity: 1; }
}

.option-label {
    font-size: 0.98rem;
    color: var(--text-primary);
    font-weight: 400;
}

/* --- Expandable ETC Text Input --- */
.etc-wrapper {
    margin-top: 12px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, opacity 0.4s ease-out;
    opacity: 0;
}

.etc-wrapper.expanded {
    max-height: 80px;
    opacity: 1;
}

.text-input, .textarea-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 14px 18px;
    color: #FFFFFF;
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.text-input:focus, .textarea-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    background: rgba(0, 0, 0, 0.4);
}

.textarea-input {
    min-height: 120px;
    resize: vertical;
}

/* --- NPS Selector (0-10) --- */
.nps-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 10px;
}

.nps-grid {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    gap: 8px;
}

@media (max-width: 768px) {
    .nps-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .nps-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.nps-btn {
    aspect-ratio: 1;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 50%;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-bounce);
    user-select: none;
}

.nps-btn:hover {
    border-color: var(--primary);
    color: #FFFFFF;
    transform: scale(1.15);
    box-shadow: 0 0 15px var(--primary-glow);
}

.nps-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
    color: #FFFFFF;
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
}

.nps-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0 6px;
}

/* --- Premium Buttons --- */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 16px;
    padding: 16px 32px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.35);
    transition: var(--transition-bounce);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(139, 92, 246, 0.5);
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--secondary-hover) 100%);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    border-radius: 12px;
    padding: 12px 24px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* --- Admin / Dashboard Styling --- */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.dashboard-title-group h1 {
    font-size: 2.2rem;
    background: linear-gradient(135deg, #FFF, var(--primary-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dashboard-title-group p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}

.btn-group {
    display: flex;
    gap: 12px;
}

/* KPI Score Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.kpi-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition-smooth);
}

.kpi-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.15);
}

.kpi-label {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.kpi-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    margin-top: 12px;
    line-height: 1.2;
}

.kpi-value.nps-high { color: var(--accent); }
.kpi-value.nps-mid { color: #F59E0B; }
.kpi-value.nps-low { color: #EF4444; }

.kpi-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Analytical Graphs */
.analytics-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

@media (min-width: 900px) {
    .analytics-section {
        grid-template-columns: 1fr 1fr;
    }
}

.analysis-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.analysis-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 12px;
}

.analysis-bars {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bar-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bar-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
}

.bar-label {
    color: var(--text-primary);
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80%;
}

.bar-percent {
    color: var(--primary-hover);
    font-weight: 600;
}

.bar-outer {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    height: 12px;
    width: 100%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.bar-inner {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    width: 0%; /* Styled dynamically via style="width: XX%" */
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Custom promoter/detractor bar */
.bar-nps-promoter { background: var(--accent); }
.bar-nps-passive { background: #F59E0B; }
.bar-nps-detractor { background: #EF4444; }

/* Table Section */
.table-card {
    overflow: hidden;
}

.table-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.table-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid var(--card-border);
}

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
    color: var(--text-primary);
}

table.admin-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 16px 20px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--card-border);
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.03em;
}

table.admin-table td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: top;
    line-height: 1.5;
}

table.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.nps-badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.nps-badge.promoter { background: rgba(16, 185, 129, 0.15); color: #34D399; border: 1px solid rgba(16, 185, 129, 0.3); }
.nps-badge.passive { background: rgba(245, 158, 11, 0.15); color: #FBBF24; border: 1px solid rgba(245, 158, 11, 0.3); }
.nps-badge.detractor { background: rgba(239, 68, 68, 0.15); color: #F87171; border: 1px solid rgba(239, 68, 68, 0.3); }

.detail-text {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.detail-text:hover {
    color: #FFFFFF;
}

.detail-text.expanded {
    white-space: normal;
    max-width: none;
}

.action-btn-del {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition-smooth);
}

.action-btn-del:hover {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
}

/* --- Login Form --- */
.login-card {
    max-width: 420px;
    width: 100%;
    margin: 80px auto;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.form-group label {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Success Card styling */
.success-card {
    text-align: center;
    padding: 60px 40px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--accent);
    color: var(--accent);
    font-size: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 28px;
    box-shadow: 0 0 25px var(--accent-glow);
    animation: successPulse 2s infinite;
}

@keyframes successPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(16, 185, 129, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-smooth);
}

footer a:hover {
    color: var(--primary-hover);
}
