/* ========== OKK AI - LIGHT CLEAN THEME ========== */
/* Based on original React app design */

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

:root {
    /* Light Theme Palette */
    --bg-primary: #f8fafc;
    --bg-white: #ffffff;
    --bg-slate-100: #f1f5f9;
    --bg-slate-200: #e2e8f0;
    
    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    
    /* Accent Colors */
    --blue-600: #2563eb;
    --blue-500: #3b82f6;
    --blue-400: #60a5fa;
    --blue-50: #eff6ff;
    --indigo-600: #4f46e5;
    --indigo-500: #6366f1;
    
    /* Status Colors */
    --emerald: #22c55e;
    --emerald-50: #f0fdf4;
    --amber: #f59e0b;
    --amber-50: #fffbeb;
    --rose: #f43f5e;
    --rose-50: #fff1f2;
    --ruby: #ef4444;
    
    /* Borders & Shadows */
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========== HEADER ========== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 80rem;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-logo { 
    display: flex; 
    align-items: center; 
    gap: 0.75rem; 
}

.logo-icon {
    width: 2rem; 
    height: 2rem;
    background: linear-gradient(135deg, var(--blue-600), var(--indigo-600));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.logo-icon svg {
    width: 1.25rem; 
    height: 1.25rem;
    color: white;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text span {
    font-weight: 300;
    color: var(--text-muted);
    -webkit-text-fill-color: var(--text-muted);
}

.header-author {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ========== MAIN ========== */
.main-container {
    max-width: 80rem;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

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

@media (min-width: 1024px) {
    .content-grid { grid-template-columns: 1fr 320px; }
}

/* ========== PAGE TITLE ========== */
.page-title {
    text-align: center;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

@media (min-width: 768px) { 
    .page-title h1 { font-size: 1.875rem; } 
}

/* ========== SECTION ========== */
.section { margin-bottom: 2rem; }

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* ========== CARD ========== */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

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

.card-header {
    padding: 1rem 1.5rem;
    background: var(--bg-slate-100);
    border-bottom: 1px solid var(--border-color);
    margin: -1.5rem -1.5rem 1.5rem;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.card-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.card-title svg { 
    width: 1.25rem; 
    height: 1.25rem; 
}

.card-title.danger { color: var(--ruby); }
.card-title.indigo { color: var(--blue-600); }
.card-title.coaching { color: var(--indigo-600); }

/* ========== FORM ========== */
.form-group { margin-bottom: 1.5rem; }

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

.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.badge {
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-slate-100);
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
}

textarea, input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text-primary);
    resize: vertical;
    transition: all 0.2s;
}

textarea:focus, input:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea::placeholder { 
    color: var(--text-muted); 
}

/* ========== TABS ========== */
.tabs {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.tab {
    background: transparent;
    border: none;
    padding: 0.5rem 0.25rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab:hover { 
    color: var(--text-secondary); 
}

.tab.active {
    color: var(--blue-600);
    border-bottom-color: var(--blue-600);
}

/* ========== FILE UPLOAD ========== */
.input-area { margin-top: 1rem; }

.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-slate-100);
}

.file-upload:hover {
    border-color: var(--blue-400);
    background: var(--blue-50);
}

.file-upload.dragover {
    border-color: var(--blue-500);
    background: var(--blue-50);
}

.file-upload.has-file {
    border-color: var(--emerald);
    border-style: solid;
    background: var(--emerald-50);
}

.file-upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.file-icon {
    width: 2.5rem; 
    height: 2.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

.file-upload:hover .file-icon {
    color: var(--blue-500);
}

.file-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.file-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== DEMO BUTTON ========== */
.textarea-wrapper { position: relative; }

.fill-demo-btn {
    position: absolute;
    top: 0.5rem; 
    right: 0.5rem;
    font-size: 0.75rem;
    font-family: inherit;
    background: var(--bg-slate-100);
    border: none;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.fill-demo-btn:hover {
    background: var(--bg-slate-200);
}

/* ========== PRIMARY BUTTON ========== */
.btn-primary {
    width: 100%;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--blue-600), var(--indigo-600));
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active:not(:disabled) { 
    transform: translateY(0); 
}

.btn-primary:disabled { 
    opacity: 0.6; 
    cursor: not-allowed; 
    background: var(--blue-400);
}

.btn-text, .btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.spinner {
    width: 1.25rem; 
    height: 1.25rem;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.btn-secondary {
    padding: 0.5rem 1rem;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-slate-100);
    border-color: var(--text-muted);
}

/* ========== PROMPT BUTTON ========== */
.prompt-toggle-btn {
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--blue-50);
    border: none;
    color: var(--blue-600);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.prompt-toggle-btn:hover {
    background: var(--blue-600);
    color: white;
}

/* ========== PROMPT VIEW ========== */
.prompt-view {
    background: var(--text-primary);
    color: var(--bg-slate-200);
    padding: 1rem;
    border-radius: var(--radius-lg);
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.75rem;
    overflow: auto;
    max-height: 15rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--text-secondary);
}

.prompt-view pre {
    white-space: pre-wrap;
    line-height: 1.5;
}

.prompt-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========== SCRIPT FILE UPLOAD ========== */
.script-file-upload {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.btn-upload-script {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-slate-100);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-upload-script:hover {
    background: var(--bg-slate-200);
    border-color: var(--text-muted);
}

.btn-upload-script svg {
    width: 1rem;
    height: 1rem;
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.script-file-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--blue-50);
    border: 1px solid rgba(37, 99, 235, 0.2);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
}

.file-info span {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--ruby);
    flex-shrink: 0;
}

.btn-remove-file {
    background: none;
    border: none;
    color: var(--rose);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-remove-file:hover {
    color: var(--ruby);
}

/* ========== RESULTS ========== */
.result-header {
    padding: 1rem;
}

.result-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.result-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.result-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.result-title .highlight {
    color: var(--blue-600);
}

.score-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 1.25rem;
    font-weight: 700;
    border: 2px solid;
}

.score-good {
    background: var(--emerald-50);
    border-color: var(--emerald);
    color: var(--emerald);
}

.score-medium {
    background: var(--amber-50);
    border-color: var(--amber);
    color: var(--amber);
}

.score-bad {
    background: var(--rose-50);
    border-color: var(--ruby);
    color: var(--ruby);
}

.result-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.result-detail {
    background: var(--bg-slate-100);
    padding: 1rem;
    border-radius: var(--radius);
}

.result-detail h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.result-detail p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========== STAGES ========== */
.stages-breakdown {
    padding: 1rem;
}

.stage-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.stage-item:last-child {
    border-bottom: none;
}

.stage-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.criteria-list {
    list-style: none;
}

.criteria-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.criteria-icon {
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.criteria-text.strikethrough {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* ========== ERRORS CARD ========== */
.errors-card {
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.errors-header {
    background: var(--rose-50);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.errors-header svg {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--ruby);
}

.errors-header h3 {
    color: var(--ruby);
}

.errors-list {
    padding: 0;
}

.error-item {
    padding: 1rem;
    border-bottom: 1px solid rgba(239, 68, 68, 0.1);
}

.error-item:last-child {
    border-bottom: none;
}

.error-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.error-stage {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.error-criterion {
    color: var(--ruby);
    font-size: 0.875rem;
}

.error-explanation {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--rose-50);
    padding: 0.75rem;
    border-radius: var(--radius);
    border-left: 3px solid var(--ruby);
    margin-top: 0.5rem;
}

/* ========== RECOMMENDATIONS ========== */
.recommendations-card {
    background: var(--blue-50);
    border-color: rgba(37, 99, 235, 0.2) !important;
}

.recommendations-card .card-header {
    background: rgba(37, 99, 235, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recommendations-card .card-header svg {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--blue-600);
}

.recommendations-card .card-header h3 {
    color: var(--blue-600);
}

.recommendations-list {
    list-style: none;
    padding: 1rem;
}

.recommendations-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.rec-bullet {
    color: var(--blue-600);
    font-weight: bold;
}

/* ========== NEXT STEP ========== */
.next-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
}

.next-step-icon {
    font-size: 1.5rem;
}

.next-step-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.next-step-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ========== RESULT ACTIONS ========== */
.result-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 0;
}

.result-actions .btn-primary svg,
.result-actions .btn-secondary svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.result-actions .btn-primary {
    width: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ========== SIDEBAR ========== */
.sidebar-column { 
    order: -1; 
}

@media (min-width: 1024px) { 
    .sidebar-column { order: 0; } 
}

.sidebar {
    background: var(--bg-slate-100);
    border-radius: var(--radius-xl);
    padding: 1rem;
    border: 1px solid var(--border-color);
    position: sticky;
    top: 6rem;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.history-list { 
    max-height: 400px; 
    overflow-y: auto; 
}

.empty-history {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    padding: 2rem 1rem;
}

.history-item {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: var(--blue-400);
    box-shadow: var(--shadow-sm);
}

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

.history-score {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius);
}

.history-score.score-good { 
    background: var(--emerald-50);
    color: var(--emerald); 
}

.history-score.score-medium { 
    background: var(--amber-50);
    color: var(--amber); 
}

.history-score.score-bad { 
    background: var(--rose-50);
    color: var(--ruby); 
}

.history-time { 
    font-size: 0.75rem; 
    color: var(--text-muted); 
}

.history-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========== ERROR MESSAGE ========== */
.error-message {
    background: var(--rose-50);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--ruby);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.error-message svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

/* ========== UTILITIES ========== */
.hidden { display: none !important; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in { animation: fadeIn 0.3s ease-out; }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { 
    width: 6px; 
    height: 6px; 
}

::-webkit-scrollbar-track { 
    background: var(--bg-slate-100); 
}

::-webkit-scrollbar-thumb { 
    background: var(--border-color); 
    border-radius: 3px; 
}

::-webkit-scrollbar-thumb:hover { 
    background: var(--text-muted); 
}

::selection { 
    background: var(--blue-500); 
    color: white; 
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .result-details {
        grid-template-columns: 1fr;
    }

    .result-header-top {
        flex-direction: column;
    }

    .script-file-upload {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-author {
        display: none;
    }
}
