/* =====================================================
   Alopecia Digital Twin System — Style Sheet
   ===================================================== */

:root {
    --bg: #060912;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.09);
    --border-bright: rgba(102, 153, 255, 0.35);
    --primary: #6699ff;
    --primary-dark: #3d6fdd;
    --accent: #a855f7;
    --accent2: #22d3ee;
    --text: #e8eaf6;
    --text-muted: #7b82b0;
    --success: #34d399;
    --warn: #fbbf24;
    --danger: #f87171;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

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

html {
    font-size:16.5px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ── Background orbs ── */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.18;
    pointer-events: none;
    z-index: 0;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: var(--primary);
    top: -150px;
    left: -150px;
    animation: drift1 14s ease-in-out infinite alternate;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--accent);
    bottom: -100px;
    right: -100px;
    animation: drift2 18s ease-in-out infinite alternate;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: var(--accent2);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: drift3 22s ease-in-out infinite alternate;
}

@keyframes drift1 {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(60px, 40px) scale(1.15);
    }
}

@keyframes drift2 {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(-50px, -30px) scale(1.1);
    }
}

@keyframes drift3 {
    from {
        transform: translate(-50%, -50%) scale(1);
    }

    to {
        transform: translate(-48%, -52%) scale(1.08);
    }
}

/* ── Container ── */
.container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

/* ── Header ── */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
    padding: 20px 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 14px;
}

.dna-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 0 20px rgba(102, 153, 255, 0.4);
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.7rem;
    font-weight: 800;
}

.gradient-text {
    background: linear-gradient(90deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 2px;
}

.panel-subtitle {
    color: var(--text-muted);
    font-size: 0.84rem;
    margin-bottom: 20px;
}

.header-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stat-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.stat-pill span {
    color: var(--text);
    font-weight: 600;
}

.stat-pill.updated {
    font-size: 0.76rem;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(0.7);
    }
}

/* ── Tab Nav ── */
.tab-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    width: fit-content;
}

.tab-btn {
    padding: 9px 22px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.tab-btn:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary-dark), var(--accent));
    color: #fff;
    box-shadow: 0 4px 14px rgba(102, 153, 255, 0.4);
}

/* ── Panels ── */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.glass-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    padding: 28px;
}

.glass-panel h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

/* ── Twin Tab Grid ── */
.twin-grid {
    display: grid;
    grid-template-columns: 320px 1fr 340px;
    grid-template-rows: auto 1fr;
    gap: 20px;
}

.controls-panel {
    grid-column: 1;
    grid-row: 1 / 3;
}

.visualization-panel {
    grid-column: 2;
    grid-row: 1 / 3;
}

.insights-panel {
    grid-column: 3;
    grid-row: 1 / 3;
    overflow: hidden;
}

/* ── Form Controls ── */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.custom-select-wrapper {
    position: relative;
}

.custom-select,
.mini-select,
.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 10px 14px;
    font-size: 0.88rem;
    appearance: none;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    cursor: pointer;
}

.custom-select:focus,
.mini-select:focus,
.search-input:focus {
    border-color: var(--border-bright);
    box-shadow: 0 0 0 3px rgba(102, 153, 255, 0.15);
}

.custom-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.custom-select option,
.mini-select option {
    background: #1a1d2e;
}

.btn-primary {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Outfit', sans-serif;
    margin-top: 8px;
    box-shadow: 0 4px 20px rgba(102, 153, 255, 0.3);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-primary:not(:disabled):hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.related-badge {
    margin-top: 14px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--accent2);
    padding: 8px;
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: var(--radius-sm);
}

/* ── Visualization Panel ── */
.visualization-panel {
    display: flex;
    flex-direction: column;
}

.centered-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
    min-height: 400px;
    position: relative;
}

.hologram-ring {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 2px solid rgba(102, 153, 255, 0.25);
    position: absolute;
    animation: spin 10s linear infinite;
}

.hologram-ring.ring2 {
    width: 160px;
    height: 160px;
    border-color: rgba(168, 85, 247, 0.2);
    animation-duration: 14s;
    animation-direction: reverse;
}

.hologram-ring.ring3 {
    width: 120px;
    height: 120px;
    border-color: rgba(34, 211, 238, 0.2);
    animation-duration: 7s;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.placeholder-text {
    position: relative;
}

.placeholder-text h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.placeholder-text p {
    font-size: 0.84rem;
    color: var(--text-muted);
    max-width: 240px;
}

.hidden {
    display: none !important;
}

#vis-active {
    flex: 1;
}

.twin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.twin-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    margin-bottom: 0;
}

.badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--primary-dark), var(--accent));
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge.small {
    font-size: 0.7rem;
    margin-left: 10px;
}

.pulse-badge {
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(102, 153, 255, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(102, 153, 255, 0.8);
    }
}

.image-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    max-height: 240px;
}

.image-container img {
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    transition: opacity 0.5s ease;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    from {
        top: 0%;
    }

    to {
        top: 100%;
    }
}

.mechanism-details h3 {
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.mechanism-details p {
    font-size: 0.84rem;
    color: var(--text-muted);
    margin-bottom: 18px;
    line-height: 1.5;
}

.desc-en {
    display: block;
    margin-bottom: 8px;
}

.desc-ko {
    display: block;
    font-size: 0.8rem;
    color: rgba(167, 200, 255, 0.75);
    background: rgba(102, 153, 255, 0.06);
    border-left: 2px solid rgba(102, 153, 255, 0.4);
    padding: 6px 10px;
    border-radius: 0 6px 6px 0;
    line-height: 1.65;
}

.stats-row {
    display: flex;
    gap: 12px;
}

.stat-box {
    flex: 1;
}

.stat-box h5 {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50px;
    height: 24px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 50px;
    display: flex;
    align-items: center;
    padding-left: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    color: white;
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.efficacy-bar {
    background: linear-gradient(90deg, var(--primary), var(--accent));
    width: 0%;
}

.bio-bar {
    background: linear-gradient(90deg, var(--accent2), var(--primary));
    width: 0%;
}

.evidence-bar {
    background: linear-gradient(90deg, var(--success), var(--accent2));
    width: 0%;
}

/* ── Insights Panel ── */
.insights-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.insights-header h2 {
    font-size: 1rem;
    margin-bottom: 0;
}

.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    margin-left: 6px;
    animation: pulse 2s infinite;
    box-shadow: 0 0 6px var(--success);
}

.insights-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 480px;
    overflow-y: auto;
}

.insights-list::-webkit-scrollbar {
    width: 4px;
}

.insights-list::-webkit-scrollbar-track {
    background: transparent;
}

.insights-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.insight-card {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    transition: border-color 0.2s;
    animation: slide-in 0.3s ease;
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(12px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.insight-card:hover {
    border-color: var(--border-bright);
}

.insight-disease {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
    color: var(--primary);
}

.insight-title {
    font-size: 0.8rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.insight-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 50px;
    background: rgba(102, 153, 255, 0.15);
    border: 1px solid rgba(102, 153, 255, 0.25);
    color: var(--primary);
}

.insight-meta span:last-child {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.84rem;
    text-align: center;
    padding: 30px;
}

.mini-select {
    width: auto;
    padding: 6px 10px;
    font-size: 0.76rem;
}

/* ── Stats Tab ── */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.chart-panel.wide {
    grid-column: 1 / -1;
}

.chart-wrapper {
    position: relative;
    height: 240px;
}

.chart-wrapper.tall {
    height: 280px;
}

/* ── Paper Library Tab ── */
.full-panel {
    width: 100%;
}

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

.library-controls h2 {
    margin-bottom: 0;
}

.library-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-input {
    width: 260px;
    padding: 8px 14px;
}

.library-filters .mini-select {
    padding: 8px 10px;
    width: auto;
}

.table-wrapper {
    overflow-x: auto;
    margin-bottom: 16px;
}

.papers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
}

.papers-table thead th {
    padding: 10px 14px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.papers-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.papers-table th.sortable:hover {
    color: var(--primary);
}

.papers-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s;
}

.papers-table tbody tr:hover {
    background: var(--surface-hover);
}

.papers-table td {
    padding: 10px 14px;
    line-height: 1.4;
    vertical-align: top;
}

.papers-table td:first-child {
    white-space: nowrap;
    font-weight: 700;
    color: var(--primary);
}

.papers-table td:nth-child(2) {
    max-width: 380px;
}

.loading-row {
    text-align: center;
    color: var(--text-muted);
    padding: 40px !important;
}

/* PDF 다운로드 아이콘 */
.pdf-icon {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
    vertical-align: middle;
}

.papers-table tbody tr:hover .pdf-icon {
    opacity: 0.9;
}

.papers-table tbody tr:hover {
    background: var(--surface-hover);
    outline: 1px solid rgba(102, 153, 255, 0.2);
    outline-offset: -1px;
}

.disease-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.disease-aga {
    background: rgba(102, 153, 255, 0.15);
    color: var(--primary);
    border: 1px solid rgba(102, 153, 255, 0.3);
}

.disease-aa {
    background: rgba(168, 85, 247, 0.15);
    color: var(--accent);
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.disease-cia {
    background: rgba(34, 211, 238, 0.15);
    color: var(--accent2);
    border: 1px solid rgba(34, 211, 238, 0.3);
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
}

.btn-page {
    padding: 7px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.btn-page:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#page-info {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ── Responsive ── */
@media (max-width: 1100px) {
    .twin-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }

    .controls-panel {
        grid-column: 1;
        grid-row: 1;
    }

    .visualization-panel {
        grid-column: 2;
        grid-row: 1;
    }

    .insights-panel {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

@media (max-width: 720px) {
    .twin-grid {
        grid-template-columns: 1fr;
    }

    .controls-panel,
    .visualization-panel,
    .insights-panel {
        grid-column: 1;
        grid-row: auto;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .chart-panel.wide {
        grid-column: 1;
    }

    .library-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-input {
        width: 100%;
    }
}