/* ==========================================================================
   Haruto Transfert - Luxurious Dark Theme
   ========================================================================== */

/* CSS Custom Properties */
:root {
    /* Color Palette - Luxurious Dark */
    --bg-primary: #0d0d0f;
    --bg-secondary: #161619;
    --bg-tertiary: #1e1e22;
    --bg-elevated: #252529;
    --bg-input: #1a1a1e;

    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-primary-hover: #818cf8;
    --accent-primary-glow: rgba(99, 102, 241, 0.3);
    --accent-success: #10b981;
    --accent-success-hover: #34d399;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;

    /* Text Colors */
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-accent: #c4b5fd;

    /* Border Colors */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.15);
    --border-focus: var(--accent-primary);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px var(--accent-primary-glow);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-image:
        radial-gradient(ellipse at top, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    background-attachment: fixed;
}

/* Layout */
main {
    max-width: 640px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-md);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: var(--space-2xl);
    padding-top: var(--space-lg);
}

header h1 {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-sm);
}

header h1 a {
    color: var(--text-primary);
    text-decoration: none;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: opacity var(--transition-base);
}

header h1 a:hover {
    opacity: 0.85;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* Cards / Sections */
.upload-section,
.download-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.upload-section::before,
.download-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.5), transparent);
}

/* File Input */
.file-input {
    margin-bottom: var(--space-lg);
}

.file-input input[type="file"] {
    width: 100%;
    padding: var(--space-lg);
    background: var(--bg-input);
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 0.9rem;
}

.file-input input[type="file"]:hover {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
}

.file-input input[type="file"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.file-input input[type="file"]::file-selector-button {
    padding: var(--space-sm) var(--space-md);
    margin-right: var(--space-md);
    background: var(--accent-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.file-input input[type="file"]::file-selector-button:hover {
    background: var(--accent-primary-hover);
}

.file-input label {
    display: block;
    margin-top: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* File Info Display */
.file-info {
    background: var(--bg-tertiary);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-subtle);
}

#file-name {
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
}

#file-size {
    color: var(--text-accent);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* TTL Select */
.ttl-select {
    margin-bottom: var(--space-lg);
}

.ttl-select label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.ttl-select select {
    width: 100%;
    max-width: 200px;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.ttl-select select:hover {
    border-color: var(--border-hover);
}

.ttl-select select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.ttl-info {
    display: inline-block;
    margin-left: var(--space-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Single Download Option */
.single-download-option {
    margin-bottom: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.option-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
    margin-left: 28px;
    line-height: 1.5;
}

/* Buttons */
button {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, var(--accent-primary) 0%, #8b5cf6 100%);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md), 0 0 0 0 var(--accent-primary-glow);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

button:hover:not(:disabled)::before {
    left: 100%;
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

button:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Progress Bar */
.progress-container {
    margin-top: var(--space-lg);
}

.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

#progress-fill,
#download-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-success));
    width: 0%;
    transition: width var(--transition-base);
    border-radius: var(--radius-full);
}

#progress-text,
#download-progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Upload Stats (Speed & ETA) */
.upload-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin-top: var(--space-md);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.upload-speed {
    color: var(--accent-primary);
}

.upload-eta {
    color: var(--text-secondary);
}

.upload-stats:empty {
    display: none;
}

/* Cancel Button */
.cancel-btn {
    margin-top: var(--space-lg);
    padding: var(--space-sm) var(--space-xl);
    background: transparent;
    border: 1px solid var(--accent-danger);
    color: var(--accent-danger);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.cancel-btn:hover:not(:disabled) {
    background: var(--accent-danger);
    color: var(--bg-primary);
}

.cancel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Result Container */
#result-container {
    animation: fadeIn var(--transition-slow) ease;
}

#result-container h2 {
    color: var(--accent-success);
    font-size: 1.25rem;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

#result-container h2::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

#share-link {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

#share-link:focus {
    outline: none;
    border-color: var(--accent-primary);
}

#copy-btn {
    margin-top: var(--space-sm);
    background: var(--accent-success);
}

#copy-btn:hover:not(:disabled) {
    background: var(--accent-success-hover);
}

/* Security Info */
.security-info {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.security-info h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.security-info ul {
    list-style: none;
    color: var(--text-secondary);
}

.security-info li {
    margin-bottom: var(--space-sm);
    padding-left: var(--space-lg);
    position: relative;
    line-height: 1.6;
}

.security-info li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 6px;
    height: 6px;
    background: var(--accent-primary);
    border-radius: 50%;
}

/* Warning */
.warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-left: 3px solid var(--accent-warning);
    padding: var(--space-md);
    margin-top: var(--space-lg);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.warning strong {
    color: var(--accent-warning);
}

/* Error */
.error {
    color: var(--accent-error);
    font-weight: 500;
}

#error-container {
    text-align: center;
    padding: var(--space-lg);
    animation: shake 0.5s ease;
}

/* Donation */
.donation {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    margin-bottom: var(--space-xl);
}

.donation h2 {
    font-size: 1.1rem;
    margin-bottom: var(--space-sm);
}

.donation p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-md);
}

.donation .address {
    display: block;
    background: var(--bg-tertiary);
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    word-break: break-all;
    color: var(--text-accent);
    border: 1px solid var(--border-subtle);
}

.copy-wallet-btn {
    display: block;
    margin: var(--space-md) auto 0;
    width: auto;
    padding: var(--space-sm) var(--space-lg);
}

/* Donation at top - more prominent styling */
.donation-top {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
}

.donation-top::before {
    content: '❤️';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.2rem;
    opacity: 0.8;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

.donation-top h2 {
    color: var(--accent-primary-hover);
}

.donation-top .address {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(99, 102, 241, 0.2);
}

/* Footer */
footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: var(--space-xl) 0;
    margin-top: auto;
    border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Language Selector with Flags
   ========================================================================== */

#lang-selector {
    position: fixed;
    top: var(--space-md);
    right: var(--space-md);
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity var(--transition-base), transform var(--transition-base);
}

#lang-selector.visible {
    opacity: 1;
    transform: translateY(0);
}

#lang-btn {
    width: auto;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#lang-btn:hover {
    background: var(--bg-tertiary);
    transform: none;
    border-color: var(--border-hover);
}

#lang-btn.open .lang-chevron {
    transform: rotate(180deg);
}

.lang-flag {
    font-size: 1.2rem;
    line-height: 1;
}

.lang-name {
    font-weight: 500;
}

.lang-chevron {
    transition: transform var(--transition-fast);
    opacity: 0.6;
}

#lang-dropdown {
    position: absolute;
    top: calc(100% + var(--space-xs));
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
    min-width: 160px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform-origin: top right;
    animation: dropdownIn var(--transition-fast) ease;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.lang-option {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    border-radius: 0;
    text-align: left;
    font-size: 0.85rem;
    transition: background var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.lang-option:hover {
    background: var(--bg-tertiary);
    transform: none;
}

.lang-option.active {
    background: rgba(99, 102, 241, 0.2);
    color: var(--text-primary);
}

.lang-option .lang-flag {
    font-size: 1.1rem;
}

.lang-check {
    margin-left: auto;
    color: var(--accent-primary);
    font-weight: bold;
}

.lang-option.selecting {
    background: var(--accent-primary);
    color: white;
}

/* Download Page */
.download-section h2 {
    margin-bottom: var(--space-md);
}

.download-section p {
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.download-section p strong {
    color: var(--text-primary);
}

#download-btn {
    margin-top: var(--space-lg);
}

#download-progress {
    margin-top: var(--space-lg);
}

/* Utility */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --space-xl: 1.5rem;
        --space-2xl: 2rem;
    }

    main {
        padding: var(--space-lg) var(--space-md);
    }

    header {
        padding-top: 3rem;
        margin-bottom: var(--space-xl);
    }

    .upload-section,
    .download-section,
    .security-info,
    .donation {
        padding: var(--space-lg);
    }

    .ttl-select select {
        width: 100%;
        max-width: none;
    }

    .ttl-info {
        display: block;
        margin-left: 0;
        margin-top: var(--space-sm);
    }

    #lang-selector {
        top: var(--space-sm);
        right: var(--space-sm);
    }

    #lang-btn {
        padding: var(--space-xs) var(--space-sm);
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .file-info {
        flex-direction: column;
        gap: var(--space-xs);
        text-align: center;
    }

    #file-name {
        max-width: 100%;
    }

    button {
        padding: var(--space-md);
    }

    #share-link {
        font-size: 0.7rem;
    }
}

/* High contrast / accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   Landing Page - Upload/Download Choice
   ========================================================================== */

.landing-section {
    margin-bottom: var(--space-xl);
}

.landing-intro {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.intro-text {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.8;
    max-width: 480px;
    margin: 0 auto;
}

.action-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-xl);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.action-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    opacity: 0;
    transition: opacity var(--transition-base);
}

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

.action-card:hover::before {
    opacity: 1;
}

.action-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    transition: all var(--transition-base);
}

.action-icon svg {
    width: 32px;
    height: 32px;
    color: var(--accent-primary);
    transition: color var(--transition-base);
}

.action-card:hover .action-icon {
    background: var(--accent-primary);
}

.action-card:hover .action-icon svg {
    color: white;
}

.action-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.action-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
}

/* Upload specific */
.action-upload:hover {
    --accent-primary: #10b981;
    --accent-primary-glow: rgba(16, 185, 129, 0.3);
}

/* Download specific */
.action-download:hover {
    --accent-primary: #8b5cf6;
    --accent-primary-glow: rgba(139, 92, 246, 0.3);
}

/* ==========================================================================
   Global Statistics
   ========================================================================== */

.global-stats {
    margin-bottom: var(--space-2xl);
    padding: var(--space-xl);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    text-align: center;
}

.global-stats h3 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.stat-card {
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    background: var(--bg-elevated);
}

.stat-icon {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-sm);
}

.stat-icon svg {
    width: 24px;
    height: 24px;
    color: var(--accent-primary);
    opacity: 0.7;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
    margin-bottom: var(--space-xs);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stats-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: var(--space-sm);
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 1.25rem;
    }
}

/* ==========================================================================
   Section Headers with Back Link
   ========================================================================== */

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

.back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: var(--space-md);
    transition: color var(--transition-fast);
}

.back-link:hover {
    color: var(--accent-primary);
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ==========================================================================
   Credential Groups (Upload Result)
   ========================================================================== */

.result-intro {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.credential-group {
    margin-bottom: var(--space-lg);
}

.credential-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.credential-field {
    display: flex;
    gap: var(--space-sm);
}

.credential-field input {
    flex: 1;
    padding: var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.credential-field input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.copy-btn {
    width: auto;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    font-size: 0.85rem;
    white-space: nowrap;
}

.copy-btn:hover:not(:disabled) {
    background: var(--bg-tertiary);
    transform: none;
    box-shadow: none;
}

.copy-btn.copied {
    background: var(--accent-success);
    border-color: var(--accent-success);
    color: white;
}

/* ==========================================================================
   Input Groups (Download Form)
   ========================================================================== */

.input-group {
    margin-bottom: var(--space-lg);
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.input-group input[type="text"] {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.input-group input[type="text"]::placeholder {
    color: var(--text-muted);
}

.input-group input[type="text"]:hover {
    border-color: var(--border-hover);
}

.input-group input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

/* ==========================================================================
   Loading Spinner
   ========================================================================== */

#loading-container {
    text-align: center;
    padding: var(--space-2xl) 0;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    margin: 0 auto var(--space-lg);
    animation: spin 1s linear infinite;
}

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

#loading-container p {
    color: var(--text-secondary);
}

/* ==========================================================================
   File Details (Download Ready)
   ========================================================================== */

.file-details {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.file-details h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-success);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.file-details h3::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent-success);
    border-radius: 50%;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-subtle);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

/* ==========================================================================
   Error Box with Retry
   ========================================================================== */

.error-box {
    text-align: center;
    padding: var(--space-xl);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
}

.error-box h3 {
    color: var(--accent-error);
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
}

.error-box .error {
    margin-bottom: var(--space-lg);
}

#retry-btn {
    width: auto;
    padding: var(--space-sm) var(--space-xl);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
}

#retry-btn:hover:not(:disabled) {
    background: var(--bg-tertiary);
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   Responsive Adjustments for New Components
   ========================================================================== */

@media (max-width: 600px) {
    .action-cards {
        grid-template-columns: 1fr;
    }

    .action-card {
        padding: var(--space-lg);
    }

    .action-icon {
        width: 56px;
        height: 56px;
    }

    .action-icon svg {
        width: 28px;
        height: 28px;
    }

    .credential-field {
        flex-direction: column;
    }

    .copy-btn {
        width: 100%;
    }

    .detail-row {
        flex-direction: column;
        gap: var(--space-xs);
    }

    .detail-value {
        word-break: break-all;
    }
}

/* ==========================================================================
   Dynamic Animations (animations.js support)
   ========================================================================== */

/* Page Transitions */
body {
    transition: opacity var(--transition-base);
}

body.page-leaving {
    opacity: 0;
}

/* Scroll Animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    transition-delay: var(--animation-delay, 0s);
}

.animate-on-scroll.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Button Ripple Effect */
button {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: rippleEffect 0.6s ease-out;
    pointer-events: none;
}

@keyframes rippleEffect {
    to {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Card Glow Effect */
.action-card,
.upload-section,
.download-section {
    --mouse-x: 50%;
    --mouse-y: 50%;
}

.action-card::after,
.upload-section::after,
.download-section::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        400px circle at var(--mouse-x) var(--mouse-y),
        rgba(99, 102, 241, 0.1),
        transparent 40%
    );
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
    border-radius: inherit;
}

.action-card:hover::after,
.upload-section:hover::after,
.download-section:hover::after {
    opacity: 1;
}

/* Progress Bar Shimmer */
.progress-bar.shimmer-enabled #progress-fill,
.progress-bar.shimmer-enabled #download-progress-fill {
    position: relative;
    overflow: hidden;
}

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

@keyframes shimmer {
    to {
        left: 100%;
    }
}

/* Input Focus Animation */
.input-group.focused label,
.file-input.focused label,
.ttl-select.focused label {
    color: var(--accent-primary);
}

/* Copy Success Animation */
.copy-btn.copy-success {
    background: var(--accent-success) !important;
    border-color: var(--accent-success) !important;
    color: white !important;
}

/* Typing Cursor */
.tagline::after {
    content: '|';
    animation: blink 1s step-end infinite;
    color: var(--accent-primary);
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Staggered Animation for Lists */
.security-info li {
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInLeft 0.5s ease forwards;
}

.security-info li:nth-child(1) { animation-delay: 0.1s; }
.security-info li:nth-child(2) { animation-delay: 0.2s; }
.security-info li:nth-child(3) { animation-delay: 0.3s; }
.security-info li:nth-child(4) { animation-delay: 0.4s; }
.security-info li:nth-child(5) { animation-delay: 0.5s; }

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

/* Floating Animation for Icons */
.action-icon {
    animation: float 3s ease-in-out infinite;
}

.action-card:nth-child(2) .action-icon {
    animation-delay: -1.5s;
}

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

/* Gradient Text Animation for Header */
header h1 a {
    background-size: 200% auto;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

/* Success Checkmark Animation */
#result-container h2::before {
    animation: scaleIn 0.3s ease, pulse 2s infinite 0.3s;
}

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

/* Skeleton Loading Effect */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 25%,
        var(--bg-elevated) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Hover Scale Effect for Interactive Elements */
.action-card,
.credential-group,
.input-group {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

/* Focus Ring Animation */
input:focus,
select:focus,
button:focus-visible {
    animation: focusRing 0.3s ease;
}

@keyframes focusRing {
    0% {
        box-shadow: 0 0 0 0 var(--accent-primary-glow);
    }
    100% {
        box-shadow: 0 0 0 4px var(--accent-primary-glow);
    }
}

/* ==========================================================================
   RTL Support (Arabic, Hebrew, etc.)
   ========================================================================== */

[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .back-link {
    direction: rtl;
}

[dir="rtl"] .back-link::before {
    content: '→';
    margin-left: var(--space-xs);
    margin-right: 0;
}

[dir="rtl"] .credential-field {
    flex-direction: row-reverse;
}

[dir="rtl"] .stats-grid {
    direction: rtl;
}

[dir="rtl"] .upload-stats {
    direction: rtl;
}

[dir="rtl"] .file-info {
    direction: rtl;
}

[dir="rtl"] .ttl-select {
    text-align: right;
}

[dir="rtl"] .checkbox-label {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

[dir="rtl"] .warning {
    text-align: right;
}

[dir="rtl"] #lang-selector {
    left: 20px;
    right: auto;
}

[dir="rtl"] .detail-row {
    flex-direction: row-reverse;
}

[dir="rtl"] .action-cards {
    direction: rtl;
}

[dir="rtl"] .security-info ul {
    padding-right: var(--space-lg);
    padding-left: 0;
}

[dir="rtl"] .donation-top::before {
    right: auto;
    left: 15px;
}

/* ==========================================================================
   Info Section - Limits & Features
   ========================================================================== */

.info-section {
    margin-top: var(--space-2xl);
    padding: var(--space-xl);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    position: relative;
}

.info-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.4), transparent);
}

.version-badge {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    padding: var(--space-xs) var(--space-sm);
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    letter-spacing: 0.05em;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.info-header {
    text-align: center;
    margin-bottom: var(--space-xl);
    padding-top: var(--space-sm);
}

.info-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Feature Cards Grid */
.feature-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.feature-card {
    padding: var(--space-lg);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.feature-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.feature-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
}

.feature-card-icon svg {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
}

.feature-card-icon--purple {
    background: rgba(139, 92, 246, 0.15);
}

.feature-card-icon--purple svg {
    color: #a78bfa;
}

.feature-card-icon--green {
    background: rgba(16, 185, 129, 0.15);
}

.feature-card-icon--green svg {
    color: var(--accent-success);
}

.feature-card-icon--orange {
    background: rgba(245, 158, 11, 0.15);
}

.feature-card-icon--orange svg {
    color: var(--accent-warning);
}

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

.feature-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* Limits Pills Section */
.limits-section {
    text-align: center;
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.limits-section h4 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-md);
}

.limits-pills {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-sm);
}

.limit-pill {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.limit-pill:hover {
    border-color: var(--accent-primary);
}

.limit-size {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.limit-duration {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.15);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.limits-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* Warning Banner */
.warning-banner {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-md);
}

.warning-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.warning-content {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.warning-content strong {
    color: var(--accent-warning);
}

/* RTL support for info section */
[dir="rtl"] .version-badge {
    right: auto;
    left: var(--space-md);
}

[dir="rtl"] .warning-banner {
    flex-direction: row-reverse;
    text-align: right;
}

/* Responsive for info section */
@media (max-width: 600px) {
    .feature-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .info-section {
        padding: var(--space-lg);
    }

    .version-badge {
        position: static;
        display: inline-block;
        margin-bottom: var(--space-lg);
    }

    .info-header {
        padding-top: 0;
    }

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

    .limits-pills {
        flex-direction: column;
        align-items: center;
    }

    .limit-pill {
        width: 100%;
        justify-content: space-between;
        max-width: 200px;
    }
}

/* ==========================================================================
   Donation Prompt (after upload/download)
   ========================================================================== */

.donation-prompt {
    margin-top: var(--space-xl);
    padding: var(--space-lg);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    text-align: center;
}

.donation-prompt p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: var(--space-md);
}

.donation-link {
    display: inline-block;
    padding: var(--space-sm) var(--space-lg);
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-full);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-base);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.donation-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.donation-prompt--inline {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
}

/* ==========================================================================
   Success Box (download complete)
   ========================================================================== */

.success-box {
    text-align: center;
    padding: var(--space-xl);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-lg);
    background: var(--accent-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.success-box h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.success-box p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

#new-download-btn {
    margin-top: var(--space-lg);
    width: 100%;
}
