/* ========================================
   File Hash Checker — Premium Dark Theme
   ======================================== */

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

:root {
    --primary: #8B5CF6;
    --primary-rgb: 139, 92, 246;
    --primary-hover: #7C3AED;
    --primary-glow: rgba(139, 92, 246, 0.25);
    --accent: #06B6D4;
    --accent-glow: rgba(6, 182, 212, 0.25);
    --success: #10B981;
    --success-glow: rgba(16, 185, 129, 0.2);
    --warning: #F59E0B;
    --danger: #EF4444;

    --bg-deep: #0C0A1D;
    --bg-base: #13112B;
    --bg-surface: #1E1B3A;
    --bg-elevated: #2D2952;
    --bg-glass: rgba(19, 17, 43, 0.85);

    --text-primary: #F1F0FF;
    --text-secondary: #A5A0D0;
    --text-muted: #6B6499;
    --text-inverse: #0C0A1D;

    --border: rgba(165, 160, 208, 0.12);
    --border-hover: rgba(165, 160, 208, 0.25);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);

    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.app {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Header ── */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
}

.header-left {
    display: flex;
    align-items: center;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.15rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 2px 10px var(--primary-glow);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-icon {
    padding: 7px;
    width: 34px;
    height: 34px;
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.btn-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.btn-copy:hover {
    color: var(--primary);
    background: rgba(139, 92, 246, 0.1);
}

/* ── Drop Zone ── */
.drop-zone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius-xl);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.03), rgba(6, 182, 212, 0.03));
    margin-bottom: 24px;
}

.drop-zone:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.07), rgba(6, 182, 212, 0.07));
    box-shadow: 0 0 30px var(--primary-glow);
}

.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(6, 182, 212, 0.08);
    box-shadow: 0 0 40px var(--accent-glow);
}

.drop-zone-content {
    position: relative;
    z-index: 1;
}

.drop-icon {
    color: var(--text-muted);
    margin-bottom: 16px;
    transition: all var(--transition-base);
}

.drop-zone:hover .drop-icon {
    color: var(--primary);
    transform: translateY(-4px);
}

.drop-text {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

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

.drop-link {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
}

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

.drop-active-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(6, 182, 212, 0.08);
    border-radius: var(--radius-xl);
    color: var(--accent);
    font-weight: 600;
    font-size: 1.1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.drop-zone.drag-over .drop-active-overlay {
    opacity: 1;
}

.drop-zone.drag-over .drop-zone-content {
    opacity: 0.2;
}

/* ── Progress ── */
.progress-container {
    margin-bottom: 24px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.82rem;
}

#progress-filename {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80%;
}

#progress-percent {
    color: var(--primary);
    font-weight: 600;
    font-family: var(--font-mono);
}

.progress-bar {
    height: 6px;
    background: var(--bg-surface);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

/* ── File Info ── */
.file-info {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
}

.file-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.82rem;
}

.file-info-row+.file-info-row {
    border-top: 1px solid var(--border);
}

.file-info-label {
    color: var(--text-muted);
}

.file-info-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    word-break: break-all;
    max-width: 60%;
}

/* ── Hash Results ── */
.results-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.hash-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
}

.hash-card {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    transition: all var(--transition-fast);
}

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

.hash-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.hash-algo {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
}

.hash-badge {
    font-size: 0.62rem;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    font-weight: 500;
}

.hash-badge.warn {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.hash-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.hash-value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    word-break: break-all;
    line-height: 1.5;
    user-select: all;
}

.hash-loading {
    color: var(--text-muted);
    font-family: var(--font-sans);
}

/* ── Compare ── */
.compare-section {
    margin-bottom: 28px;
}

.compare-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.compare-input {
    flex: 1;
    padding: 9px 12px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color var(--transition-fast);
}

.compare-input:focus {
    border-color: var(--primary);
}

.compare-result {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
}

.compare-result.match {
    background: var(--success-glow);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.compare-result.no-match {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--danger);
}

/* ── Export ── */
.export-section {
    margin-bottom: 40px;
    text-align: center;
}

/* ── History Panel ── */
.history-panel {
    position: fixed;
    top: 0;
    right: -380px;
    bottom: 0;
    width: 360px;
    background: var(--bg-base);
    border-left: 1px solid var(--border);
    z-index: 200;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
}

.history-panel.open {
    right: 0;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.history-list .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.history-item {
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.history-item:hover {
    background: var(--bg-surface);
}

.history-item-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.history-item-hash {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
}

/* ── Toast ── */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 16px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: 0.85rem;
    color: var(--text-primary);
    animation: toast-in 0.3s ease-out;
    max-width: 340px;
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.info {
    border-left: 3px solid var(--primary);
}

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

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

/* ── Responsive ── */
@media (max-width: 600px) {
    .app {
        padding: 0 12px;
    }

    .drop-zone {
        padding: 32px 16px;
    }

    .logo span {
        display: none;
    }

    .hash-card {
        padding: 12px 14px;
    }

    .compare-input-wrapper {
        flex-direction: column;
    }
}

/* ── Animations ── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

.hash-results,
.file-info,
.compare-section,
.export-section {
    animation: fadeIn 0.4s ease-out;
}