/**
 * EPI Viewer Styles - Web Integration
 * 
 * Design Philosophy: Unified with main website (Dark, Premium, Trustworthy)
 * Matches style.css variables and aesthetics.
 */

:root {
    /* Mapped from style.css for consistency */
    --bg-primary: #000000;
    --bg-secondary: #0A0D15;
    --bg-card: #141B2D;

    --color-primary: #0A84FF;
    --color-primary-light: #409CFF;

    --color-success: #30D158;
    --color-error: #FF453A;
    --color-warning: #FFD60A;

    --text-primary: #FFFFFF;
    --text-secondary: #D1D5DB;
    --text-muted: #94A3B8;

    --border-subtle: #262626;
    --border-default: #3A3A3A;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Courier New', monospace;

    --radius-md: 1rem;
    --radius-sm: 0.75rem;
}

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

body {
    font-family: var(--font-sans);
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    /* App-like feel */
    height: 100vh;
}

#app {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* State Views */
.state-view {
    display: none;
    flex: 1;
    overflow: auto;
}

.state-view.active {
    display: flex;
    flex-direction: column;
}

/* ============================================
   INITIAL STATE: No File Loaded
   ============================================ */

.initial-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.epi-logo {
    margin-bottom: 2rem;
    transition: transform 0.3s ease;
}

.epi-logo:hover {
    transform: scale(1.05);
}

.initial-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #FFFFFF 0%, #E2E8F0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
}

/* Primary Button (Matches Main Site) */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: #FFFFFF;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(10, 132, 255, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(10, 132, 255, 0.6);
}

/* Drop Zone */
.drop-zone {
    margin-top: 1rem;
    padding: 4rem 2rem;
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    max-width: 600px;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover,
.drop-zone.drag-active {
    border-color: var(--color-primary);
    background: rgba(10, 132, 255, 0.05);
    transform: scale(1.01);
}

.info-text {
    margin-top: 3rem;
    max-width: 500px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.8;
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.info-text strong {
    color: var(--text-primary);
}

/* ============================================
   LOADING STATE
   ============================================ */

.loading-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s infinite linear;
    margin-bottom: 2rem;
}

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

.loading-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
}

#verification-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 300px;
}

.step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.step.loading {
    border-color: var(--color-primary);
    box-shadow: 0 0 15px rgba(10, 132, 255, 0.1);
}

.step-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.step.complete .step-icon {
    color: var(--color-success);
}

.step.error .step-icon {
    color: var(--color-error);
}

/* ============================================
   ERROR STATE
   ============================================ */

.error-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.error-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 69, 58, 0.1);
    color: var(--color-error);
    border: 2px solid var(--color-error);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
}

.error-message {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.error-details {
    background: #000;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    margin-bottom: 2rem;
    max-width: 600px;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--color-error);
    overflow-x: auto;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

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

/* ============================================
   VIEWER STATE
   ============================================ */

/* Status Banner */
.status-banner {
    background: var(--bg-card);
    border-bottom: 2px solid var(--color-success);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
}

.status-indicator.verified {
    color: var(--color-success);
    text-shadow: 0 0 10px rgba(48, 209, 88, 0.3);
}

.status-details {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-left: 3rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.separator {
    color: var(--border-default);
}

.btn-small {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Evidence Summary */
.evidence-summary {
    background: rgba(20, 27, 45, 0.5);
    /* Semi-transparent card bg */
    border-bottom: 1px solid var(--border-subtle);
    padding: 1.5rem 2rem;
    backdrop-filter: blur(10px);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

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

.summary-value {
    font-size: 0.95rem;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* Layer Tabs */
.layer-tabs {
    display: flex;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-subtle);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--color-primary-light);
    border-bottom-color: var(--color-primary);
    background: rgba(10, 132, 255, 0.05);
}

/* Layer Content */
.layer-content {
    background: var(--bg-primary);
    flex: 1;
    overflow: auto;
    padding: 0;
}

.layer-panel {
    display: none;
    flex-direction: column;
    padding: 2rem;
    min-height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.layer-panel.active {
    display: flex;
}

.layer-header h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.layer-description {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Embedded Viewer */
.embedded-viewer-container {
    background: #fff;
    /* Iframe usually needs white bg unless dark mode supported content */
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    height: 85vh;
    /* Increased from 600px to give maximum space */
    width: 100%;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
}

.embedded-viewer-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Facts Table */
.facts-table {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    background: var(--bg-card);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-subtle);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
}

td:first-child {
    color: var(--color-primary-light);
    width: 30%;
}

td:nth-child(2) {
    font-family: var(--font-mono);
}

/* Crypto Details */
.crypto-details {
    background: #000;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}