/* ================================
   CSS RESET & CUSTOM PROPERTIES
================================ */
:root {
    /* Primary Color Palette */
    --bg-primary: #0a0c0f;
    --bg-secondary: #0d1117;
    --bg-tertiary: rgba(13, 17, 23, 0.95);
    
    /* Container & Surface Colors */
    --surface-primary: rgba(22, 27, 34, 0.9);
    --surface-secondary: rgba(30, 36, 46, 0.85);
    --surface-elevated: rgba(33, 38, 49, 0.95);
    
    /* Border & Accent Colors */
    --border-primary: rgba(48, 54, 61, 0.5);
    --border-accent: rgba(0, 174, 255, 0.35);
    --border-hover: rgba(0, 174, 255, 0.6);
    
    /* Glow & Shadow Effects */
    --glow-primary: rgba(0, 174, 255, 0.4);
    --glow-intense: rgba(0, 174, 255, 0.7);
    --glow-subtle: rgba(0, 174, 255, 0.2);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.5);
    
    /* Text Colors */
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --text-accent: #58a6ff;
    
    /* Semantic Colors */
    --color-primary: #0969da;
    --color-primary-light: #218bff;
    --color-primary-dark: #0550ae;
    --color-success: #1a7f37;
    --color-success-light: #2ea043;
    --color-danger: #cf222e;
    --color-danger-light: #da3633;
    --color-warning: #9a6700;
    --color-warning-light: #bf8700;
    --color-info: #0969da;
    
    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Oxygen', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Monaco, 'Inconsolata', monospace;
    --font-display: 'Space Grotesk', 'Inter', sans-serif;
    
    /* Font Weights */
    --fw-light: 300;
    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;
    
    /* Spacing Scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    --transition-slower: 500ms ease;
    
    /* Z-index Scale */
    --z-negative: -1;
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-popover: 500;
    --z-tooltip: 600;
}

/* ================================
   GLOBAL RESET & BASE STYLES
================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-weight: var(--fw-regular);
    line-height: 1.6;
    min-height: 100vh;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    
    padding: 0 var(--space-md);
    padding-top: 140px;
    overflow-x: hidden;
    
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(0, 174, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0, 174, 255, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(0, 174, 255, 0.02) 0%, transparent 50%);
}

/* Typography Enhancement */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--fw-bold);
    line-height: 1.2;
    color: var(--text-primary);
}

a {
    color: var(--text-accent);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--color-primary-light);
}

/* Selection Styles */
::selection {
    background: var(--color-primary);
    color: white;
}

::-moz-selection {
    background: var(--color-primary);
    color: white;
}

/* Focus Styles for Accessibility */
:focus-visible {
    outline: 2px solid var(--color-primary-light);
    outline-offset: 2px;
}

/* ================================
   ANIMATED BACKGROUND
================================ */
.background-animation {
    position: fixed;
    inset: 0;
    z-index: var(--z-negative);
    pointer-events: none;
}

.background-word {
    position: absolute;
    font-family: var(--font-mono);
    font-size: clamp(0.8rem, 2vw, 1.2rem);
    font-weight: var(--fw-bold);
    color: rgba(0, 174, 255, 0.06);
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: drift linear infinite;
    user-select: none;
    filter: blur(0.5px);
}

@keyframes drift {
    0% { 
        opacity: 0;
        transform: translate(0, 0) rotate(0deg) scale(0.8);
    }
    10% { 
        opacity: 0.6;
    }
    90% { 
        opacity: 0.6;
    }
    100% { 
        opacity: 0;
        transform: translate(var(--drift-x), var(--drift-y)) rotate(360deg) scale(1.1);
    }
}

/* Parallax Effect for Background */
@media (prefers-reduced-motion: no-preference) {
    .background-word:nth-child(odd) {
        animation-duration: 25s;
    }
    
    .background-word:nth-child(even) {
        animation-duration: 30s;
        animation-delay: -5s;
    }
}

/* ================================
   NAVIGATION BAR - ADVANCED
================================ */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    z-index: var(--z-sticky);
    
    display: flex;
    justify-content: center;
    align-items: center;
    
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
}

.navbar {
    width: 100%;
    max-width: 1200px;
    
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(1rem, 3vw, 2.5rem);
    
    padding: var(--space-md) var(--space-lg);
    margin: 0 var(--space-md);
    
    background: linear-gradient(135deg, 
        rgba(13, 17, 23, 0.85) 0%,
        rgba(22, 27, 34, 0.75) 100%);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    
    box-shadow: 
        var(--shadow-lg),
        0 0 40px var(--glow-subtle),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
        
    transition: all var(--transition-base);
}

.navbar:hover {
    border-color: var(--border-accent);
    box-shadow: 
        var(--shadow-xl),
        0 0 60px var(--glow-primary),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.navbar a {
    position: relative;
    font-family: var(--font-mono);
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: var(--space-sm) var(--space-md);
    transition: all var(--transition-base);
}

.navbar a::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--color-primary-light) 50%, 
        transparent 100%);
    transform: translateX(-50%);
    transition: width var(--transition-base);
}

.navbar a:hover,
.navbar a.active {
    color: var(--text-primary);
    text-shadow: 0 0 20px var(--glow-primary);
    transform: translateY(-2px);
}

.navbar a:hover::before,
.navbar a.active::before {
    width: 100%;
}

/* ================================
   MAIN CONTAINER - GLASS MORPHISM
================================ */
.container {
    width: 100%;
    max-width: 1000px;
    
    background: linear-gradient(135deg,
        var(--surface-primary) 0%,
        var(--surface-secondary) 100%);
    
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    
    box-shadow: 
        var(--shadow-xl),
        0 0 80px var(--glow-subtle),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    
    animation: containerFadeIn 0.8s ease-out;
    position: relative;
}

.container::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg,
        var(--border-accent) 0%,
        transparent 50%,
        var(--border-accent) 100%);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: destination-out;
    opacity: 0.3;
}

@keyframes containerFadeIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ================================
   HEADER SECTION - ENHANCED
================================ */
.main-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid rgba(48, 54, 61, 0.3);
    position: relative;
}

.main-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--color-primary-light) 50%,
        transparent 100%);
    transform: translateX(-50%);
}

.main-header h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: var(--fw-bold);
    background: linear-gradient(135deg, 
        var(--text-primary) 0%, 
        var(--color-primary-light) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 40px var(--glow-primary);
    margin-bottom: var(--space-sm);
    letter-spacing: -0.5px;
    
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { filter: brightness(1) contrast(1); }
    to { filter: brightness(1.1) contrast(1.1); }
}

.main-header p {
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    font-weight: var(--fw-light);
    color: var(--text-secondary);
    letter-spacing: 1px;
    opacity: 0.9;
}

/* ================================
   UPLOAD ZONE - MODERN DESIGN
================================ */
.upload-form {
    text-align: center;
    margin-top: var(--space-xl);
}

.drop-zone {
    width: 100%;
    min-height: 220px;
    
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: var(--space-md);
    
    background: linear-gradient(135deg,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.1) 100%);
    
    border: 2px dashed var(--border-primary);
    border-radius: var(--radius-lg);
    
    cursor: pointer;
    position: relative;
    overflow: hidden;
    
    transition: all var(--transition-base);
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at center,
        transparent 0%,
        var(--glow-subtle) 100%
    );
    opacity: 0;
    transition: opacity var(--transition-base);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--color-primary-light);
    background: linear-gradient(135deg,
        rgba(0, 174, 255, 0.05) 0%,
        rgba(0, 174, 255, 0.02) 100%);
    transform: scale(1.01);
    box-shadow: 
        0 0 30px var(--glow-primary),
        inset 0 0 30px var(--glow-subtle);
}

.drop-zone:hover::before,
.drop-zone.drag-over::before {
    opacity: 1;
}

.drop-zone-prompt {
    font-size: clamp(1rem, 2vw, 1.3rem);
    font-weight: var(--fw-medium);
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.drop-zone-prompt::before {
    content: '📁';
    font-size: 3rem;
    filter: grayscale(0.5);
    transition: all var(--transition-base);
}

.drop-zone:hover .drop-zone-prompt::before {
    transform: scale(1.1) rotate(5deg);
    filter: grayscale(0);
}

.drop-zone-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-info {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: rgba(0, 255, 127, 0.1);
    border: 1px solid var(--color-success);
    border-radius: var(--radius-md);
    color: var(--color-success-light);
    font-family: var(--font-mono);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status-message {
    margin-top: var(--space-md);
    font-weight: var(--fw-semibold);
    min-height: 28px;
    transition: all var(--transition-base);
}

.status-message.error {
    color: var(--color-danger-light);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ================================
   SCAN BUTTON - ADVANCED STYLES
================================ */
.scan-button {
    width: 100%;
    max-width: 400px;
    padding: var(--space-md) var(--space-xl);
    margin: var(--space-xl) auto 0;
    
    font-family: var(--font-mono);
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 2px;
    
    color: var(--text-primary);
    background: linear-gradient(135deg,
        rgba(9, 105, 218, 0.1) 0%,
        rgba(0, 174, 255, 0.1) 100%);
    
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-md);
    
    cursor: pointer;
    position: relative;
    overflow: hidden;
    
    transition: all var(--transition-base);
    box-shadow: 
        0 4px 15px rgba(0, 174, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.scan-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        var(--color-primary-light) 0%,
        transparent 70%
    );
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.scan-button:hover:not(:disabled) {
    color: white;
    border-color: var(--color-primary-light);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 30px rgba(0, 174, 255, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.scan-button:hover:not(:disabled)::before {
    width: 300%;
    height: 300%;
}

.scan-button:active:not(:disabled) {
    transform: translateY(0);
}

.scan-button:disabled {
    background: rgba(100, 100, 100, 0.1);
    border-color: var(--border-primary);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.5;
}

.scan-button.scanning {
    pointer-events: none;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { 
        box-shadow: 0 0 20px var(--glow-primary);
    }
    50% { 
        box-shadow: 0 0 40px var(--glow-intense);
    }
}

/* ================================
   RESULTS SECTION - MODERN DESIGN
================================ */
.verdict-section {
    padding: var(--space-xl);
    margin: var(--space-xl) 0;
    border-radius: var(--radius-lg);
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: resultsFadeIn 0.6s ease-out;
}

@keyframes resultsFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.verdict-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        transparent 0%,
        rgba(255, 255, 255, 0.02) 100%);
    pointer-events: none;
}

.verdict-section.malware {
    background: linear-gradient(135deg,
        rgba(207, 34, 46, 0.15) 0%,
        rgba(207, 34, 46, 0.05) 100%);
    border: 2px solid var(--color-danger);
    box-shadow: 
        0 0 40px rgba(207, 34, 46, 0.3),
        inset 0 0 30px rgba(207, 34, 46, 0.1);
}

.verdict-section.benign {
    background: linear-gradient(135deg,
        rgba(26, 127, 55, 0.15) 0%,
        rgba(26, 127, 55, 0.05) 100%);
    border: 2px solid var(--color-success);
    box-shadow: 
        0 0 40px rgba(26, 127, 55, 0.3),
        inset 0 0 30px rgba(26, 127, 55, 0.1);
}

.prediction-text {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: var(--fw-bold);
    margin-bottom: var(--space-lg);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.verdict-section.malware .prediction-text {
    color: var(--color-danger-light);
    text-shadow: 0 0 20px var(--color-danger);
}

.verdict-section.benign .prediction-text {
    color: var(--color-success-light);
    text-shadow: 0 0 20px var(--color-success);
}

.confidence-bar {
    width: 100%;
    height: 40px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-primary);
    position: relative;
    overflow: hidden;
    margin: var(--space-lg) 0;
}

.confidence-fill {
    height: 100%;
    width: var(--confidence-width, 0%);
    border-radius: inherit;
    position: relative;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.verdict-section.malware .confidence-fill {
    background: linear-gradient(90deg,
        var(--color-danger) 0%,
        var(--color-danger-light) 100%);
    box-shadow: 0 0 20px var(--color-danger);
}

.verdict-section.benign .confidence-fill {
    background: linear-gradient(90deg,
        var(--color-success) 0%,
        var(--color-success-light) 100%);
    box-shadow: 0 0 20px var(--color-success);
}

.confidence-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%);
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

.confidence-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: var(--fw-bold);
    font-size: 1.1rem;
    color: var(--text-primary);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ================================
   LOADING STATES - PROFESSIONAL
================================ */
.loader,
.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-primary);
    border-top-color: var(--color-primary-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

.loading-dots {
    display: inline-flex;
    gap: var(--space-xs);
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 1;
    }
    30% {
        transform: translateY(-10px);
        opacity: 0.5;
    }
}

/* ================================
   RESPONSIVE DESIGN
================================ */
@media (max-width: 768px) {
    :root {
        font-size: 14px;
    }
    
    body {
        padding-top: 120px;
    }
    
    .navbar {
        gap: var(--space-md);
        padding: var(--space-sm) var(--space-md);
    }
    
    .container {
        padding: var(--space-xl);
        border-radius: var(--radius-lg);
    }
    
    .main-header h1 {
        font-size: 1.8rem;
    }
    
    .drop-zone {
        min-height: 180px;
    }
}

@media (max-width: 480px) {
    .navbar a {
        font-size: 0.85rem;
        padding: var(--space-xs) var(--space-sm);
    }
    
    .container {
        padding: var(--space-lg);
    }
    
    .scan-button {
        font-size: 1rem;
        letter-spacing: 1px;
    }
}

/* ================================
   ACCESSIBILITY ENHANCEMENTS
================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --border-primary: rgba(255, 255, 255, 0.5);
        --text-secondary: #ffffff;
        --text-muted: #cccccc;
    }
}

/* Dark Mode Enhancement */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #000000;
        --surface-primary: rgba(16, 20, 28, 0.95);
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .navbar,
    .background-animation,
    .scan-button {
        display: none;
    }
}

/* ================================
   UTILITY CLASSES
================================ */
.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mt-4 { margin-top: var(--space-xl); }

.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.mb-4 { margin-bottom: var(--space-xl); }

.fadeIn {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}