/**
 * TopicFlow Career Edge - Main Stylesheet
 * © Nandax Factory 2026
 * 
 * ChatGPT-like minimal dark/light theme
 */

:root {
    /* Dark theme (default) */
    --bg-primary: #1e293b;
    --bg-secondary: #0f172a;
    --bg-panel: #334155;
    --bg-panel-hover: #475569;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --border-color: #475569;
    --border-subtle: #334155;

    --accent-primary: #8b5cf6;
    --accent-secondary: #7c3aed;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-panel: #f1f5f9;
    --bg-panel-hover: #e2e8f0;

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;

    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
}

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: all 0.2s;
}

.card:hover {
    background: var(--bg-panel-hover);
    box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-panel);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:hover {
    background: var(--bg-panel-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: translateY(0);
}

.btn.primary {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.btn.primary:hover {
    background: var(--accent-secondary);
}

.btn.secondary {
    background: transparent;
    border-color: var(--border-color);
}

.btn.success {
    background: var(--accent-success);
    color: white;
    border-color: var(--accent-success);
}

.btn.warn {
    background: var(--accent-warning);
    color: white;
    border-color: var(--accent-warning);
}

.btn.small {
    padding: 6px 12px;
    font-size: 13px;
}

.btn:disabled,
.btn.locked-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Form inputs */
.input,
.select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
}

.input:focus,
.select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.input::placeholder {
    color: var(--text-muted);
}

/* Grid */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* Header/Navbar */
.navbar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 20px;
    font-weight: 600;
    color: var(--accent-primary);
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin: 8px 0;
}

.kpi-label {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Progress bar */
.progress {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent-primary);
    transition: width 0.3s ease;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}

.badge.primary {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.badge.success {
    background: var(--accent-success);
    color: white;
    border-color: var(--accent-success);
}

.badge.warning {
    background: var(--accent-warning);
    color: white;
    border-color: var(--accent-warning);
}

/* Modal */
.tf-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.tf-modal.show {
    opacity: 1;
}

.tf-modal.closing {
    opacity: 0;
}

.tf-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.tf-modal-content {
    position: relative;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform 0.2s;
}

.tf-modal.show .tf-modal-content {
    transform: scale(1);
}

.tf-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tf-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.tf-modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tf-modal-body {
    padding: 24px;
}

.tf-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Toast */
.tf-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 400px;
    z-index: 999;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
}

.tf-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.tf-toast.hiding {
    opacity: 0;
    transform: translateY(20px);
}

.tf-toast-success {
    border-left: 4px solid var(--accent-success);
}

.tf-toast-error {
    border-left: 4px solid var(--accent-error);
}

.tf-toast-info {
    border-left: 4px solid var(--accent-primary);
}

.tf-toast button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
}

/* Loading spinner */
.tf-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.tf-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* RBAC Lock Styles */
.locked-blur {
    filter: blur(4px);
    pointer-events: none;
    user-select: none;
}

.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

.lock-icon {
    font-size: 32px;
    opacity: 0.7;
}

/* Question cards */
.question-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 20px;
}

.question-text {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 24px;
    text-align: center;
}

.answer-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-option {
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.answer-option:hover {
    border-color: var(--accent-primary);
    background: var(--bg-panel);
}

.answer-option.selected {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* Slider */
.slider-container {
    padding: 20px;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-secondary);
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: none;
}

/* Utility classes */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 12px;
    }

    .navbar {
        flex-direction: column;
        gap: 12px;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .tf-toast {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }
}