/* ============================================
   UPANH - DESIGN SYSTEM
   Premium Dark Theme + Glassmorphism
   ============================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ============================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================ */
:root {
    /* Colors - Dark Theme */
    --bg-primary: #0a0a14;
    --bg-secondary: #0f0f1e;
    --bg-tertiary: #161630;
    --bg-card: rgba(22, 22, 48, 0.65);
    --bg-card-hover: rgba(30, 30, 60, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);

    /* Accent Gradient */
    --gradient-primary: linear-gradient(135deg, #a855f7, #6366f1, #3b82f6);
    --gradient-accent: linear-gradient(135deg, #c084fc, #818cf8);
    --gradient-success: linear-gradient(135deg, #34d399, #06b6d4);
    --gradient-warm: linear-gradient(135deg, #f472b6, #a855f7);

    /* Solid Colors */
    --purple-400: #c084fc;
    --purple-500: #a855f7;
    --purple-600: #9333ea;
    --indigo-400: #818cf8;
    --indigo-500: #6366f1;
    --blue-400: #60a5fa;
    --blue-500: #3b82f6;
    --cyan-400: #22d3ee;
    --green-400: #4ade80;
    --green-500: #22c55e;
    --pink-400: #f472b6;
    --red-400: #f87171;
    --red-500: #ef4444;
    --amber-400: #fbbf24;

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #c084fc;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(168, 85, 247, 0.3);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(168, 85, 247, 0.15);
    --shadow-glow-strong: 0 0 60px rgba(168, 85, 247, 0.25);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Layout */
    --max-width: 1200px;
    --sidebar-width: 180px;
    --header-height: 72px;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::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 {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse 600px 600px at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 80% 80%, rgba(168, 85, 247, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 400px 400px at 50% 50%, rgba(59, 130, 246, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    will-change: transform;
    transform: translateZ(0);
}

a {
    color: var(--purple-400);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--purple-500);
}

img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 20, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    height: var(--header-height);
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    text-decoration: none;
    transition: transform var(--transition-spring);
}

.logo:hover {
    transform: scale(1.05);
    color: var(--text-primary);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--shadow-glow);
}

.logo-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    list-style: none;
}

.nav-menu a {
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition-fast), background-color var(--transition-fast);
    position: relative;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-sm);
}

/* ============================================
   AD BANNER SLOTS
   ============================================ */
.ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    min-height: 50px;
}

.ad-slot::before {
    content: attr(data-label);
    position: absolute;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
    pointer-events: none;
}

/* Khi có quảng cáo thật, ẩn label */
.ad-slot.has-ad::before {
    display: none;
}

.ad-slot.has-ad {
    border-style: solid;
    border-color: transparent;
}

.ad-top-banner,
.ad-middle-banner,
.ad-bottom-banner,
.ad-footer-banner {
    max-width: 728px;
    width: 100%;
    min-height: 90px;
    margin: var(--space-md) auto;
}

.ad-sidebar {
    width: 160px;
    min-height: 600px;
    flex-shrink: 0;
}

/* ============================================
   MAIN LAYOUT (3 cột với sidebar ads)
   ============================================ */
.page-wrapper {
    position: relative;
    z-index: 1;
}

.main-content-area {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-lg);
    display: flex;
    gap: var(--space-lg);
    align-items: flex-start;
}

.content-center {
    flex: 1;
    min-width: 0;
}

/* ============================================
   UPLOAD ZONE
   ============================================ */
.upload-section {
    margin-bottom: var(--space-xl);
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.section-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: var(--space-sm);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 500px;
    margin: 0 auto;
}

.upload-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-lg);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.upload-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* Server Selector */
.server-selector {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    background: var(--bg-glass);
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.server-option {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
}

.server-option:hover {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

.server-option.active {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.server-option .server-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green-400);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-3xl) var(--space-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--purple-500);
    background: rgba(168, 85, 247, 0.05);
}

.drop-zone.drag-over::before {
    opacity: 0.05;
}

.drop-zone.drag-over {
    transform: scale(1.01);
    box-shadow: var(--shadow-glow-strong);
}

.drop-zone-icon {
    font-size: 3.5rem;
    margin-bottom: var(--space-md);
    display: block;
    animation: float 3s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

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

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

.drop-zone-text h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.drop-zone-text p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.drop-zone-text .browse-btn {
    display: inline-block;
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
    background: var(--gradient-primary);
    color: #fff;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-spring);
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
}

.drop-zone-text .browse-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(168, 85, 247, 0.4);
    color: #fff;
}

/* File Input Hidden */
.file-input {
    display: none;
}

/* Preview (Multi-file) */
.preview-area {
    display: none;
    margin-top: var(--space-lg);
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.preview-area.active {
    display: block;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-glass-hover);
    border-bottom: 1px solid var(--border-subtle);
}

.preview-count {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-accent);
}

.preview-clear-all {
    background: none;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    font-family: var(--font-family);
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.preview-clear-all:hover {
    border-color: var(--red-400);
    color: var(--red-400);
}

.preview-list {
    max-height: 320px;
    overflow-y: auto;
    padding: var(--space-xs);
}

.preview-list::-webkit-scrollbar {
    width: 5px;
}

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

.preview-list::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: var(--radius-full);
}

/* Individual Preview Item */
.preview-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-subtle);
}

.preview-item:last-child {
    border-bottom: none;
}

.preview-item:hover {
    background: var(--bg-glass-hover);
}

.preview-item-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border-light);
    flex-shrink: 0;
}

.preview-item-info {
    flex: 1;
    min-width: 0;
}

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

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

.preview-item-status {
    flex-shrink: 0;
    font-size: 1rem;
    width: 28px;
    text-align: center;
}

.preview-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.preview-item-remove:hover {
    color: var(--red-400);
    background: rgba(248, 113, 113, 0.1);
}

/* Status indicators */
.status-pending { opacity: 0.4; }
.status-success { animation: popIn 0.3s ease; }
.status-error { animation: popIn 0.3s ease; cursor: help; }

.status-uploading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mini-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-light);
    border-top-color: var(--purple-400);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Progress overall counter */
.progress-overall {
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-accent);
    margin-bottom: var(--space-xs);
}

/* Bulk actions (copy all links) */
.result-bulk-actions {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(52, 211, 153, 0.2);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.bulk-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.bulk-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--green-400);
}

.bulk-btns {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.bulk-copy-btn {
    padding: var(--space-sm) var(--space-lg);
    background: var(--gradient-success);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font-family);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-spring);
    box-shadow: 0 4px 15px rgba(52, 211, 153, 0.3);
}

.bulk-copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(52, 211, 153, 0.4);
}

.bulk-copy-btn.copied {
    background: var(--gradient-primary);
}

/* Upload Button */
.upload-btn-wrap {
    margin-top: var(--space-lg);
    display: none;
}

.upload-btn-wrap.active {
    display: block;
    animation: slideUp 0.3s ease;
}

.upload-btn {
    width: 100%;
    padding: 14px var(--space-xl);
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-spring);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.upload-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(168, 85, 247, 0.4);
}

.upload-btn:active:not(:disabled) {
    transform: translateY(0);
}

.upload-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.upload-btn .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.upload-btn.uploading .spinner {
    display: inline-block;
}

.upload-btn.uploading .btn-text {
    display: none;
}

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

/* Progress Bar */
.progress-bar-wrap {
    display: none;
    margin-top: var(--space-md);
}

.progress-bar-wrap.active {
    display: block;
    animation: slideUp 0.3s ease;
}

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

.progress-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
    text-align: center;
}

/* ============================================
   UPLOAD RESULT
   ============================================ */
.result-section {
    display: none;
    margin-top: var(--space-xl);
}

.result-section.active {
    display: block;
    animation: slideUp 0.4s ease;
}

.result-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-lg);
}

.result-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
}

.result-header .success-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

.result-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.result-header .server-badge {
    margin-left: auto;
    padding: 4px 12px;
    background: var(--bg-glass-hover);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Result Preview Image */
.result-preview {
    display: flex;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.result-image-wrap {
    width: 200px;
    flex-shrink: 0;
}

.result-image {
    width: 100%;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-light);
    transition: transform var(--transition-normal);
}

.result-image:hover {
    transform: scale(1.05);
}

.result-image-info {
    margin-top: var(--space-sm);
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

/* Link Items */
.result-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    min-width: 0;
}

.link-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    transition: all var(--transition-fast);
}

.link-item:hover {
    border-color: var(--border-accent);
    background: var(--bg-glass-hover);
}

.link-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 75px;
    flex-shrink: 0;
}

.link-value {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    user-select: all;
    min-width: 0;
}

.copy-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    background: var(--bg-glass-hover);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 4px;
}

.copy-btn:hover {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
}

.copy-btn.copied {
    background: var(--gradient-success);
    color: #fff;
    border-color: transparent;
}

/* ============================================
   UPLOAD HISTORY
   ============================================ */
.history-section {
    margin-top: var(--space-xl);
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.history-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.history-clear {
    padding: 6px 14px;
    background: none;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-family);
    font-size: 0.78rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.history-clear:hover {
    border-color: var(--red-400);
    color: var(--red-400);
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-sm);
}

.history-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border-subtle);
    cursor: pointer;
    transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    group: true;
}

.history-item:hover {
    border-color: var(--purple-500);
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-item .overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.history-item:hover .overlay {
    opacity: 1;
}

.history-item .overlay span {
    font-size: 0.7rem;
    color: #fff;
    font-weight: 500;
    padding: 4px 8px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
}

.history-empty {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============================================
   STATIC PAGES (About, Terms)
   ============================================ */
.page-content {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-lg);
    max-width: 800px;
    margin: var(--space-xl) auto;
}

.page-content h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: var(--space-lg);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-content h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
}

.page-content p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    line-height: 1.8;
}

.page-content ul {
    color: var(--text-secondary);
    padding-left: var(--space-lg);
    margin-bottom: var(--space-md);
}

.page-content li {
    margin-bottom: var(--space-sm);
    line-height: 1.7;
}

.page-content li::marker {
    color: var(--purple-400);
}

/* Feature Cards */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.feature-card {
    padding: var(--space-lg);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    text-align: center;
    transition: border-color var(--transition-normal), transform var(--transition-normal), box-shadow var(--transition-normal);
}

.feature-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.feature-card .icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.feature-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.feature-card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    border-top: 1px solid var(--border-subtle);
    background: rgba(10, 10, 20, 0.6);
    margin-top: var(--space-3xl);
    position: relative;
    z-index: 1;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg) var(--space-lg);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-2xl);
    margin-bottom: var(--space-xl);
}

.footer-brand .logo {
    margin-bottom: var(--space-md);
    font-size: 1.3rem;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
}

.footer-links h4 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-md);
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--space-sm);
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--purple-400);
}

.footer-bottom {
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.footer-bottom p {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.footer-bottom .social-links {
    display: flex;
    gap: var(--space-sm);
}

.footer-bottom .social-links a {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.footer-bottom .social-links a:hover {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
    z-index: 1000;
    transform: translateX(120%);
    transition: transform var(--transition-spring);
}

.toast.show {
    transform: translateX(0);
}

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

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

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .ad-sidebar {
        display: none;
    }
    
    .main-content-area {
        padding: var(--space-md);
    }
}

@media (max-width: 768px) {
    .site-header {
        background: rgba(10, 10, 20, 0.98) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .upload-card,
    .result-card,
    .toast,
    .page-content {
        background: rgba(22, 22, 48, 0.95) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .nav-menu {
        background: rgba(10, 10, 20, 0.98) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .section-header h1 {
        font-size: 1.6rem;
    }

    .section-header p {
        font-size: 0.9rem;
    }

    .menu-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: var(--header-height);
        left: 0;
        width: 100%;
        background: rgba(10, 10, 20, 0.95);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: var(--space-md);
        border-bottom: 1px solid var(--border-subtle);
    }

    .nav-menu.open {
        display: flex;
    }

    .nav-menu a {
        width: 100%;
        padding: var(--space-md);
    }

    .result-preview {
        flex-direction: column;
    }

    .result-image-wrap {
        width: 100%;
    }

    .link-item {
        flex-wrap: wrap;
    }

    .link-value {
        order: 3;
        width: 100%;
        font-size: 0.72rem;
    }

    .copy-btn {
        margin-left: auto;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .drop-zone {
        padding: var(--space-2xl) var(--space-md);
    }

    .upload-card {
        padding: var(--space-md);
    }
}

@media (max-width: 480px) {
    .section-header h1 {
        font-size: 1.4rem;
    }

    .server-selector {
        flex-direction: column;
    }

    .history-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }

    .result-card {
        padding: var(--space-md);
    }
}

/* ============================================
   UTILITY ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.animate-fadeIn { animation: fadeIn 0.5s ease; }
.animate-slideUp { animation: slideInUp 0.5s ease; }
.animate-slideDown { animation: slideInDown 0.5s ease; }
.animate-scaleIn { animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Stagger animations */
.stagger > * {
    animation: slideInUp 0.4s ease both;
}

.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }
