@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');

:root {
    /* Light Theme Variables (Primary) */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --accent-orange: #ff3b00;
    --accent-orange-hover: #e03400;
    --accent-orange-light: rgba(255, 59, 0, 0.08);
    --accent-orange-border: rgba(255, 59, 0, 0.2);
    
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --card-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 8px -1px rgba(15, 23, 42, 0.02);
    --card-shadow-hover: 0 12px 30px -4px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
    
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.6);
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.1);
    --error: #ef4444;
    --error-light: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-light: rgba(59, 130, 246, 0.1);
    
    --transition-speed: 0.3s;
    --border-radius-sm: 8px;
    --border-radius-md: 14px;
    --border-radius-lg: 24px;
}

[data-theme="dark"] {
    /* Dark Theme Variables */
    --bg-primary: #090d16;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #6b7280;
    
    --accent-orange: #ff4d17;
    --accent-orange-hover: #ff6033;
    --accent-orange-light: rgba(255, 77, 23, 0.12);
    --accent-orange-border: rgba(255, 77, 23, 0.3);
    
    --border-color: #1f2937;
    --border-hover: #374151;
    
    --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
    --card-shadow-hover: 0 12px 30px -4px rgba(0, 0, 0, 0.7);
    
    --glass-bg: rgba(17, 24, 39, 0.7);
    --glass-border: rgba(31, 41, 55, 0.6);
    
    --success: #34d399;
    --success-light: rgba(52, 211, 153, 0.15);
    --warning: #fbbf24;
    --warning-light: rgba(251, 191, 36, 0.15);
    --error: #f87171;
    --error-light: rgba(248, 113, 113, 0.15);
    --info: #60a5fa;
    --info-light: rgba(96, 165, 250, 0.15);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Premium Layout & Header */
header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

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

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    height: 38px;
    width: auto;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.logo-img:hover {
    transform: scale(1.03);
}

.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--text-muted);
    color: var(--text-primary);
    transform: rotate(15deg);
}

.theme-toggle-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Main Content Area */
main {
    flex: 1;
    max-width: 800px;
    width: 90%;
    margin: 2.5rem auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

main.admin-main {
    max-width: 1200px;
}

/* Card Styling - Glassmorphic */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--card-shadow);
    padding: 2.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color var(--transition-speed), border-color var(--transition-speed);
}

.glass-card:hover {
    box-shadow: var(--card-shadow-hover);
}

/* Input Fields & Buttons */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1.2rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

.form-control:focus {
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 3px var(--accent-orange-light);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    padding: 0.85rem 1.8rem;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--accent-orange);
    color: #ffffff;
    box-shadow: 0 4px 14px 0 rgba(255, 59, 0, 0.3);
}

.btn-primary:hover {
    background-color: var(--accent-orange-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(255, 59, 0, 0.4);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn-danger {
    background-color: var(--error-light);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

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

/* Custom Customization for Radio / Options Selection */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1rem;
}

.option-card {
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    position: relative;
    background-color: var(--bg-secondary);
    transition: all 0.2s ease;
}

.option-card:hover {
    border-color: var(--border-hover);
    background-color: var(--bg-tertiary);
}

.option-card.selected {
    border-color: var(--accent-orange);
    background-color: var(--accent-orange-light);
}

.option-radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.option-card.selected .option-radio {
    border-color: var(--accent-orange);
}

.option-radio::after {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent-orange);
    transform: scale(0);
    transition: transform 0.2s ease;
}

.option-card.selected .option-radio::after {
    transform: scale(1);
}

.option-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
    user-select: none;
}

/* Questionnaire Specific CSS */
.question-container {
    display: none;
}

.question-container.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background-color: var(--border-color);
    border-radius: 3px;
    margin-bottom: 2.5rem;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--accent-orange);
    width: 0%;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-tag {
    background-color: var(--accent-orange-light);
    color: var(--accent-orange);
    border: 1px solid var(--accent-orange-border);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-block;
    margin-bottom: 0.8rem;
}

.question-text {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 2.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.comment-toggle-btn {
    background: none;
    border: none;
    color: var(--accent-orange);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 1rem;
    outline: none;
}

.comment-toggle-btn:hover {
    color: var(--accent-orange-hover);
    text-decoration: underline;
}

.comment-field {
    margin-top: 0.8rem;
    display: none;
}

.comment-field.active {
    display: block;
    animation: slideDown 0.3s ease-out;
}

/* Access Token Portal Page */
.portal-card {
    max-width: 460px;
    margin: 0 auto;
    text-align: center;
}

.portal-logo {
    height: 50px;
    margin-bottom: 1.5rem;
}

.portal-title {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.portal-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.alert-message {
    padding: 0.85rem 1.2rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    display: none;
    text-align: left;
}

.alert-danger {
    background-color: var(--error-light);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
    background-color: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Success / Completion view */
.success-checkmark {
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
    background-color: var(--success-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
}

.success-checkmark svg {
    width: 40px;
    height: 40px;
}

/* Admin Dashboard CSS */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.stat-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    line-height: 1;
}

.stat-icon {
    align-self: flex-end;
    margin-top: -1.5rem;
    width: 32px;
    height: 32px;
    color: var(--accent-orange);
    opacity: 0.2;
}

.dashboard-sections {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 900px) {
    .dashboard-sections {
        grid-template-columns: 350px 1fr;
    }
}

/* Admin Tables */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background-color: var(--bg-secondary);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.admin-table th {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-bottom: 1.5px solid var(--border-color);
    font-family: 'Outfit', sans-serif;
}

.admin-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    white-space: nowrap;
}

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

.admin-table tbody tr:hover td {
    background-color: var(--bg-tertiary);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-pending {
    background-color: var(--warning-light);
    color: var(--warning);
}

.badge-submitted {
    background-color: var(--success-light);
    color: var(--success);
}

/* Password Gate Modal Overlay */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-primary);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    margin: 1.5rem;
    text-align: center;
}

/* Modal details */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 650px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.active .modal-box {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
}

/* Submission Q&A View styles */
.qa-item {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

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

.qa-id {
    font-weight: 700;
    color: var(--accent-orange);
    margin-right: 0.5rem;
    font-size: 0.85rem;
}

.qa-question {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.qa-answer {
    background-color: var(--bg-tertiary);
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
    border-left: 3px solid var(--accent-orange);
}

.qa-comment {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    background-color: var(--bg-primary);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
}

.code-block {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.85rem;
    padding: 1.2rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    white-space: pre-wrap;
    max-height: 350px;
    overflow-y: auto;
}

/* Keyframe Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Copy Link Toast */
.toast-msg {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(40px);
    background-color: var(--text-primary);
    color: var(--bg-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    z-index: 500;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.toast-msg.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Footer Section */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

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

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