/* ===== GoKSeF V3 Design System ===== */

/* --- App Shell --- */
.v3-shell {
    font-family: "Manrope", system-ui, sans-serif;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 56px 1fr;
    background: #FAFAF9;
    color: #0F172A;
}

.v3-content-area {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.v3-logo {
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #0F172A;
    line-height: 1;
}

.v3-logo-accent {
    color: #0D9488;
}

.v3-beta-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    background: #0F172A;
    color: #5EEAD4;
    margin-left: 10px;
}

.v3-header-left,
.v3-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.v3-header-btn {
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #64748B;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.v3-header-btn:hover {
    color: #0F172A;
    background: #F5F5F4;
    border-color: #E7E5E4;
}

.v3-header-dropdown {
    position: relative;
}

.v3-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.v3-sidebar-bottom {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.v3-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: rgba(250, 250, 249, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(231, 229, 228, 0.6);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.5),
        0 4px 16px -4px rgba(15, 23, 42, 0.08),
        0 16px 48px -16px rgba(15, 23, 42, 0.12);
}

.v3-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 4px;
    width: 56px;
    background: #FAFAF9;
    border-right: 1px solid #E7E5E4;
    box-shadow: 1px 0 8px -2px rgba(15, 23, 42, 0.04);
}

.v3-sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: #94A3B8;
    transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    border: none;
    background: transparent;
}

.v3-sidebar-link:hover {
    color: #475569;
    background: #F5F5F4;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.v3-sidebar-link.active {
    color: #0D9488;
    background: #F0FDFA;
    box-shadow: 0 1px 4px rgba(13, 148, 136, 0.1);
}

.v3-sidebar-link.active::before {
    content: "";
    position: absolute;
    left: -8px;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #0D9488;
}

.v3-sidebar-spacer {
    flex: 1;
}

.v3-main {
    flex: 1;
    padding: 32px;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
}

.v3-footer {
    padding: 16px 24px;
    text-align: center;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: #94A3B8;
    border-top: 1px solid #E7E5E4;
}

/* --- Cards --- */
.v3-card {
    background: #FFFFFF;
    border: 1px solid #E7E5E4;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 12px 40px -30px rgba(15, 23, 42, 0.15);
}

.v3-card-padded {
    padding: 20px;
}

/* --- Micro Labels --- */
.v3-micro {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #94A3B8;
}

/* --- Compact Status Bar --- */
.v3-status-bar {
    position: sticky;
    top: 56px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
    height: 48px;
    background: #0F172A;
    color: #FFFFFF;
    font-size: 14px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.v3-status-bar .metric-blocker { color: #FB7185; }
.v3-status-bar .metric-warning { color: #FBBF24; }
.v3-status-bar .metric-neutral { color: rgba(255, 255, 255, 0.6); }

/* --- Issue Cards --- */
.v3-issue {
    background: #FFFFFF;
    border: 1px solid #E7E5E4;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    border-left-width: 4px;
    border-left-style: solid;
}

.v3-issue-blocker { border-left-color: #E11D48; }
.v3-issue-warning { border-left-color: #F59E0B; }
.v3-issue-info { border-left-color: #94A3B8; }

/* --- Health Bar --- */
.v3-health-track {
    height: 8px;
    border-radius: 9999px;
    background: #E7E5E4;
    overflow: hidden;
}

.v3-health-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.4s ease, background 0.4s ease;
}

.v3-health-good { background: linear-gradient(90deg, #059669, #10B981); }
.v3-health-mid { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.v3-health-bad { background: linear-gradient(90deg, #E11D48, #FB7185); }

/* --- Verdict Card --- */
.v3-verdict {
    max-width: 520px;
    margin: 0 auto;
    padding: 40px;
    text-align: center;
}

.v3-verdict-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    font-size: 28px;
    margin-bottom: 20px;
}

.v3-verdict-success .v3-verdict-icon { background: #ECFDF5; color: #059669; }
.v3-verdict-warning .v3-verdict-icon { background: #FFFBEB; color: #F59E0B; }
.v3-verdict-error .v3-verdict-icon { background: #FFF1F2; color: #E11D48; }

/* --- Input (Stan 1) --- */
.v3-input-centered {
    max-width: 640px;
    margin: 0 auto;
}

.v3-dropzone {
    position: relative;
    overflow: hidden;
    min-height: 224px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    border: 2px dashed #D6D3D1;
    border-radius: 20px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    background: #FAFAF9;
}

.v3-dropzone:hover {
    border-color: #0D9488;
    background: rgba(240, 253, 250, 0.5);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.06);
}

.v3-dropzone.loading {
    border-color: #14B8A6;
    background: #F0FDFA;
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.08);
}

.v3-dropzone::after {
    content: "";
    position: absolute;
    inset: auto -15% -30% auto;
    width: 240px;
    height: 240px;
    border-radius: 9999px;
    background: radial-gradient(circle, rgba(13, 148, 136, 0.08), transparent 70%);
    pointer-events: none;
}

/* --- Paste Input --- */
.v3-paste-area {
    min-height: 224px;
    width: 100%;
    resize: vertical;
    border-radius: 12px;
    border: 1px solid #E7E5E4;
    background: #FFFFFF;
    padding: 16px;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 12px;
    line-height: 1.7;
    color: #1E293B;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.v3-paste-area::placeholder {
    color: #94A3B8;
}

.v3-paste-area:focus {
    border-color: #0D9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

/* --- File Info Bar --- */
.v3-file-info {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    border-radius: 12px;
    background: #FAFAF9;
    padding: 12px 16px;
    border: 1px solid #F5F5F4;
}

/* --- Session History Item --- */
.v3-session-item {
    padding: 10px 16px;
}

/* --- Workspace Grid --- */
.v3-workspace-grid {
    display: grid;
    grid-template-columns: minmax(380px, 1.3fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

/* --- AI Elements --- */
.v3-ai-badge {
    color: #7C3AED;
    font-size: 11px;
    font-weight: 700;
}

.v3-ai-card {
    background: rgba(245, 243, 255, 0.5);
    border: 1px solid #DDD6FE;
    border-left-width: 4px;
    border-left-color: #A78BFA;
    border-radius: 12px;
    padding: 16px;
}

.v3-ai-button {
    color: #7C3AED;
    border: 1px solid #DDD6FE;
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.v3-ai-button:hover {
    background: #F5F3FF;
}

.v3-ai-tab-active {
    background: #F5F3FF;
    color: #4C1D95;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* --- Document Tabs --- */
.v3-tab {
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #64748B;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    background: transparent;
}

.v3-tab:hover { color: #0F172A; }

.v3-tab-active {
    background: #FFFFFF;
    color: #0F172A;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* --- Code Block --- */
.v3-code {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    background: #020617;
    color: #E2E8F0;
    border-radius: 16px;
    padding: 20px;
    font-size: 12px;
    line-height: 1.7;
    overflow-x: auto;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 20px 50px -30px rgba(2, 6, 23, 0.6);
}

/* --- KPI Cards --- */
.v3-kpi {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.v3-kpi-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1;
}

/* --- Collapsible Section --- */
.v3-section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 0;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.v3-section-toggle svg {
    transition: transform 0.2s ease;
    color: #94A3B8;
}

.v3-section-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* --- History Table --- */
.v3-history-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.1s ease;
}

.v3-history-row:hover {
    background: #F5F5F4;
}

/* --- Buttons --- */
.v3-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #FFFFFF;
    background: #059669;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(5, 150, 105, 0.3);
}

.v3-btn-primary:hover {
    background: #047857;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.v3-btn-primary:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.v3-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    background: #FFFFFF;
    border: 1px solid #D6D3D1;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.v3-btn-secondary:hover {
    background: #F5F5F4;
}

.v3-btn-sm {
    padding: 7px 16px;
    font-size: 13px;
}

.v3-btn-warn {
    background: #D97706;
    color: #FFFFFF;
    border: none;
    box-shadow: 0 1px 3px rgba(217, 119, 6, 0.3);
}

.v3-btn-warn:hover {
    background: #B45309;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

/* --- Print --- */
@media print {
    .v3-sidebar, .v3-header, .v3-footer, .v3-status-bar { display: none !important; }
    .v3-shell { grid-template-columns: 1fr; }
    .v3-main { padding: 0; }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .v3-workspace-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .v3-shell {
        grid-template-columns: 1fr;
    }
    .v3-sidebar { display: none; }
    .v3-main { padding: 16px; }
}

/* --- Headings --- */
.v3-shell h1,
.v3-shell h2,
.v3-shell h3 {
    letter-spacing: -0.035em;
}

.v3-shell code,
.v3-shell pre {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
}

/* --- Tooltip (sidebar) --- */
.v3-sidebar-link .v3-tooltip {
    display: none;
    position: absolute;
    left: 54px;
    top: 50%;
    transform: translateY(-50%);
    padding: 5px 10px;
    border-radius: 8px;
    background: #0F172A;
    color: #E2E8F0;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
    pointer-events: none;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

.v3-sidebar-link:hover .v3-tooltip {
    display: block;
}

/* --- Issue Navigation Footer --- */
.v3-issue-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px;
    border-top: 1px solid #E7E5E4;
    font-size: 14px;
    color: #64748B;
}

.v3-issue-nav button {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #E7E5E4;
    background: #FFFFFF;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    transition: all 0.1s ease;
}

.v3-issue-nav button:hover { background: #F5F5F4; }
.v3-issue-nav button:disabled { opacity: 0.3; pointer-events: none; }
