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

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --danger-gradient: linear-gradient(135deg, #f56565 0%, #c53030 100%);
    --success-gradient: linear-gradient(135deg, #48bb78 0%, #2f855a 100%);
    --bg-light: #ffffff;
    --bg-dark: #1a202c;
    --text-light: #2d3748;
    --text-dark: #e2e8f0;
    --card-light: #f7fafc;
    --card-dark: #2d3748;
    --border-light: #e2e8f0;
    --border-dark: #4a5568;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    color: #333;
    transition: all 0.3s ease;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="2"/></svg>') repeat;
    pointer-events: none;
    animation: rotate 60s linear infinite;
}

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

/* Dark Mode */
body.dark-mode {
    background: linear-gradient(135deg, #1a1f2e 0%, #2d1b3a 100%);
}

body.dark-mode .upload-card,
body.dark-mode .results-section,
body.dark-mode .stat-card,
body.dark-mode .analysis-item,
body.dark-mode .file-info-card,
body.dark-mode .history-section {
    background: var(--card-dark);
    color: var(--text-dark);
    border-color: var(--border-dark);
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.theme-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.theme-btn:hover {
    background: white;
    color: #667eea;
    border-color: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    text-align: center;
    color: white;
    margin-bottom: 50px;
}

.glow {
    font-size: 4rem;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 20px rgba(255, 255, 255, 0.5); }
    to { text-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 0 40px rgba(102, 126, 234, 0.5); }
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    font-weight: 300;
    margin-bottom: 20px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 14px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #48bb78;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* Upload Card */
.upload-card {
    background: white;
    border-radius: 40px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.1);
    border: 3px dashed #cbd5e0;
    transition: all 0.3s ease;
    cursor: pointer;
    max-width: 800px;
    margin: 0 auto;
}

.upload-card:hover {
    border-color: #667eea;
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.15);
}

.upload-card.dragover {
    border-color: #48bb78;
    background: #f0fff4;
}

.upload-icon {
    font-size: 6rem;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.upload-card h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #2d3748;
}

.upload-text {
    color: #718096;
    margin-bottom: 30px;
}

.browse-text {
    color: #667eea;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.file-requirements {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.requirement-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #718096;
    font-size: 0.9rem;
}

/* Loading Section */
.loading-section {
    text-align: center;
    background: white;
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 0 auto;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.analysis-steps {
    margin-top: 30px;
    text-align: left;
}

.step {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.step.completed {
    color: #48bb78;
}

.step.failed {
    color: #f56565;
}

.step-icon {
    font-size: 1.5rem;
    margin-right: 15px;
    width: 30px;
}

.step-text {
    flex: 1;
}

.step-status {
    font-size: 1.2rem;
}

/* Results Section */
.results-section {
    background: white;
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

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

.new-scan-btn {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.new-scan-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

/* File Info Card */
.file-info-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 20px;
    margin-bottom: 30px;
}

.file-icon-large {
    font-size: 3rem;
}

.file-details {
    flex: 1;
}

.file-details h3 {
    margin-bottom: 5px;
}

.file-meta {
    color: #718096;
    font-size: 0.9rem;
}

.meta-separator {
    margin: 0 8px;
}

.risk-indicator {
    text-align: center;
    min-width: 100px;
}

.risk-level {
    font-size: 1.2rem;
    font-weight: 700;
    padding: 5px 15px;
    border-radius: 20px;
}

.risk-level.safe {
    background: #c6f6d5;
    color: #22543d;
}

.risk-level.low {
    background: #fefcbf;
    color: #744210;
}

.risk-level.medium {
    background: #feebc8;
    color: #7b341e;
}

.risk-level.high {
    background: #fed7d7;
    color: #742a2a;
}

.risk-level.critical {
    background: #fc8181;
    color: #63171b;
}

.risk-score {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 5px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #f7fafc;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.stat-label {
    color: #718096;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 5px;
}

.stat-sub {
    color: #a0aec0;
    font-size: 0.8rem;
}

/* Detailed Analysis */
.detailed-analysis {
    margin-bottom: 30px;
}

.detailed-analysis h3 {
    margin-bottom: 20px;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.analysis-item {
    background: #f7fafc;
    padding: 20px;
    border-radius: 15px;
}

.analysis-item.full-width {
    grid-column: span 2;
}

.analysis-item h4 {
    margin-bottom: 15px;
    color: #4a5568;
}

.analysis-table {
    width: 100%;
}

.analysis-table td {
    padding: 8px 0;
    border-bottom: 1px solid #e2e8f0;
}

.analysis-table td:first-child {
    color: #718096;
}

.analysis-table td:last-child {
    font-weight: 500;
    text-align: right;
}

/* Entropy Meter */
.entropy-meter {
    margin: 15px 0;
}

.meter-bar {
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 5px;
}

.meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #48bb78, #f56565);
    border-radius: 5px;
    transition: width 0.3s ease;
}

.meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #718096;
}

/* Hash Container */
.hash-container {
    background: #2d3748;
    border-radius: 10px;
    padding: 15px;
}

.hash-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hash-label {
    color: #a0aec0;
    font-size: 0.9rem;
    min-width: 80px;
}

.hash-value {
    color: #48bb78;
    font-family: monospace;
    font-size: 0.9rem;
    word-break: break-all;
    flex: 1;
}

.copy-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: #4a5568;
}

/* Keywords Cloud */
.keywords-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 15px;
}

.keyword-tag {
    background: #fed7d7;
    color: #742a2a;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

/* Reasons List */
.reasons-list {
    list-style: none;
    padding: 20px;
    background: #f7fafc;
    border-radius: 15px;
}

.reasons-list li {
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 10px;
}

.reasons-list li:last-child {
    border-bottom: none;
}

.reasons-list li::before {
    content: '•';
    color: #667eea;
    font-size: 1.5rem;
}

/* Footer */
footer {
    text-align: center;
    color: white;
    margin-top: 50px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.footer-small {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 5px;
}

/* ========== HISTORY SECTION WITH CLOSE BUTTONS ========== */

.history-section {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    overflow-y: auto;
    padding: 20px;
    animation: slideIn 0.3s ease;
}

body.dark-mode .history-section {
    background: #2d3748;
    color: #e2e8f0;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* History Header with Close Buttons */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

body.dark-mode .history-header {
    border-bottom-color: #4a5568;
}

.history-close-buttons {
    display: flex;
    gap: 10px;
}

.minimize-history, .close-history {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #718096;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.minimize-history:hover {
    background: #e2e8f0;
    color: #4a5568;
    transform: scale(1.1);
}

.close-history:hover {
    background: #fed7d7;
    color: #c53030;
    transform: scale(1.1);
}

body.dark-mode .minimize-history,
body.dark-mode .close-history {
    color: #a0aec0;
}

body.dark-mode .minimize-history:hover {
    background: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .close-history:hover {
    background: #742a2a;
    color: #fed7d7;
}

/* Minimized state */
.history-section.minimized {
    width: 60px;
    height: 60px;
    overflow: hidden;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--primary-gradient);
}

.history-section.minimized:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.history-section.minimized > *:not(.history-header) {
    display: none;
}

.history-section.minimized .history-header h2 {
    display: none;
}

.history-section.minimized .history-close-buttons {
    display: none;
}

.history-section.minimized::after {
    content: '📋';
    font-size: 30px;
    position: absolute;
    top: 15px;
    left: 15px;
}

/* History Footer */
.history-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #e2e8f0;
    text-align: center;
}

body.dark-mode .history-footer {
    border-top-color: #4a5568;
}

/*.close-history-bottom {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    font-size: 16px;
    transition: all 0.3s ease;
}

/*.close-history-bottom:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(197, 48, 48, 0.3);
}*/

/* Arrow indicator for history toggle */
.history-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-toggle-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.6);
}

.history-toggle-btn::after {
    content: '→';
    font-size: 20px;
    transition: transform 0.3s ease;
}

.history-toggle-btn:hover::after {
    transform: translateX(5px);
}

/* When history is open, change arrow direction */
.history-visible .history-toggle-btn::after {
    content: '←';
}

.history-visible .history-toggle-btn:hover::after {
    transform: translateX(-5px);
}

.history-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.history-search {
    flex: 1;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.history-search:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.history-filter {
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
}

body.dark-mode .history-search,
body.dark-mode .history-filter {
    background: #4a5568;
    border-color: #718096;
    color: white;
}

.clear-history-btn {
    padding: 10px 20px;
    background: #f56565;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.clear-history-btn:hover {
    background: #c53030;
    transform: translateY(-2px);
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 15px;
}

body.dark-mode .history-stats {
    background: #4a5568;
}

.history-stat {
    text-align: center;
}

.history-stat .stat-label {
    font-size: 12px;
    color: #718096;
    display: block;
    margin-bottom: 5px;
}

.history-stat .stat-value {
    font-size: 20px;
    font-weight: 700;
}

.safe-text {
    color: #48bb78;
}

.fake-text {
    color: #f56565;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f7fafc;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.history-item:hover {
    transform: translateX(-5px);
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

body.dark-mode .history-item {
    background: #4a5568;
}

.history-item-icon {
    font-size: 30px;
    width: 40px;
    text-align: center;
}

.history-item-details {
    flex: 1;
}

.history-item-name {
    font-weight: 600;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item-status {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.history-item-status.safe {
    background: #c6f6d5;
    color: #22543d;
}

.history-item-status.fake {
    background: #fed7d7;
    color: #742a2a;
}

.history-item-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #718096;
}

.history-item-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.history-empty {
    text-align: center;
    padding: 40px;
    color: #718096;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .glow {
        font-size: 2.5rem;
    }
    
    .upload-card {
        padding: 40px 20px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .analysis-grid {
        grid-template-columns: 1fr;
    }
    
    .analysis-item.full-width {
        grid-column: span 1;
    }
    
    .file-info-card {
        flex-direction: column;
        text-align: center;
    }
    
    .history-section {
        width: 100%;
    }
    
    .history-toggle-btn {
        bottom: 20px;
        right: 20px;
        padding: 12px 24px;
        font-size: 14px;
    }
}