/* Dark Mode Theme for FileTransfer */

/* Color System */
:root {
    /* Primary colors */
    --dark-bg-0: #0a0a0a;
    --dark-bg-1: #121212;
    --dark-bg-2: #1e1e1e;
    --dark-bg-3: #252525;
    --dark-bg-4: #2a2a2a;
    
    /* Text colors - Improved contrast for better readability */
    --dark-text-primary: #fafafa;
    --dark-text-secondary: #e4e4e7;
    --dark-text-muted: #a1a1aa;
    
    /* Accent colors */
    --dark-accent-primary: #3b82f6;
    --dark-accent-secondary: #8b5cf6;
    --dark-accent-tertiary: #06b6d4;
    --dark-accent-success: #10b981;
    --dark-accent-warning: #f59e0b;
    --dark-accent-danger: #ef4444;
    
    /* Border colors */
    --dark-border-subtle: rgba(255, 255, 255, 0.06);
    --dark-border-default: rgba(255, 255, 255, 0.12);
    --dark-border-strong: rgba(255, 255, 255, 0.24);
    
    /* Gradients */
    --dark-gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --dark-gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --dark-gradient-surface: linear-gradient(180deg, var(--dark-bg-2) 0%, var(--dark-bg-1) 100%);
    
    /* Shadows */
    --dark-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.5);
    --dark-shadow-md: 0 4px 8px rgba(0, 0, 0, 0.6);
    --dark-shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.7);
    --dark-shadow-xl: 0 16px 32px rgba(0, 0, 0, 0.8);
    --dark-shadow-glow: 0 0 20px rgba(59, 130, 246, 0.5);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Bootstrap overrides for better readability */
    --bs-secondary-color: #e4e4e7;
    --bs-secondary-color-rgb: 228, 228, 231;
    --bs-body-color: #fafafa;
    --bs-body-color-rgb: 250, 250, 250;
    --bs-emphasis-color: #e4e4e7;
    --bs-emphasis-color-rgb: 228, 228, 231;
}

/* Base styles override */
body {
    background-color: var(--dark-bg-0) !important;
    color: var(--dark-text-primary) !important;
}

/* Improved text contrast - Override Bootstrap with higher specificity */
body .text-muted,
.card .text-muted,
p.text-muted,
span.text-muted {
    color: #e4e4e7;
    opacity: 1;
}

body .text-secondary,
.card .text-secondary {
    color: #e4e4e7;
}

/* Fix for all paragraph and text elements */
p, span, div {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ensure Bootstrap's muted text uses our color */
.encryption-header .text-muted,
.encryption-selector-hero .text-muted {
    color: #e4e4e7;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg-1);
}

::-webkit-scrollbar-thumb {
    background: var(--dark-bg-4);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-accent-primary);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--dark-text-primary) !important;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.display-title {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    background: var(--dark-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
}

/* Navigation override */
.navbar {
    background: rgba(18, 18, 18, 0.8) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--dark-border-subtle) !important;
    position: relative;
    z-index: 1050;
}

.navbar-brand {
    color: var(--dark-text-primary) !important;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand:before {
    content: "🚀";
    width: 32px;
    height: 32px;
    background: var(--dark-gradient-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.nav-link {
    color: var(--dark-text-secondary) !important;
    transition: all var(--transition-fast);
    border-radius: 8px;
    padding: 0.5rem 1rem !important;
}

.nav-link:hover {
    color: var(--dark-text-primary) !important;
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-menu {
    background: var(--dark-bg-2) !important;
    border: 1px solid var(--dark-border-default) !important;
    box-shadow: var(--dark-shadow-lg) !important;
    z-index: 1060;
}

.dropdown-item {
    color: var(--dark-text-secondary) !important;
}

.dropdown-item:hover {
    background: var(--dark-bg-3) !important;
    color: var(--dark-text-primary) !important;
}

.dropdown-divider {
    border-color: var(--dark-border-default) !important;
}

/* Container overrides */
.container-main {
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 15px;
    padding-right: 15px;
}

.upload-container,
.card {
    background: var(--dark-bg-2) !important;
    border: 1px solid var(--dark-border-subtle) !important;
    box-shadow: var(--dark-shadow-lg) !important;
    transition: all var(--transition-base);
}

.upload-container:hover,
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--dark-shadow-xl) !important;
    border-color: var(--dark-border-default) !important;
}

/* Buttons */
.btn {
    transition: all var(--transition-base);
    border-radius: 8px;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--dark-gradient-primary) !important;
    border: none !important;
    box-shadow: var(--dark-shadow-md), var(--dark-shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--dark-shadow-lg), 0 0 30px rgba(59, 130, 246, 0.6);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--transition-slow);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-secondary {
    background: var(--dark-bg-3) !important;
    color: var(--dark-text-primary) !important;
    border: 1px solid var(--dark-border-default) !important;
}

.btn-secondary:hover {
    background: var(--dark-bg-4) !important;
    border-color: var(--dark-border-strong) !important;
    transform: translateY(-1px);
}

/* Forms */
.form-control,
.form-select {
    background: var(--dark-bg-1) !important;
    border: 1px solid var(--dark-border-default) !important;
    color: var(--dark-text-primary) !important;
    transition: all var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    background: var(--dark-bg-2) !important;
    border-color: var(--dark-accent-primary) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.form-control::placeholder {
    color: var(--dark-text-muted) !important;
}

.form-label {
    color: var(--dark-text-secondary) !important;
    font-weight: 500;
}

/* Dropzone */
.dropzone {
    background: var(--dark-bg-1) !important;
    border: 2px dashed var(--dark-border-default) !important;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.dropzone::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--dark-accent-primary) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.dropzone:hover {
    border-color: var(--dark-accent-primary) !important;
    background: rgba(59, 130, 246, 0.05) !important;
}

.dropzone:hover::before {
    opacity: 0.1;
}

.dropzone.dz-drag-hover {
    border-color: var(--dark-accent-primary) !important;
    background: rgba(59, 130, 246, 0.1) !important;
}

.dropzone .dz-message {
    color: var(--dark-text-secondary) !important;
}

.icon-cloud-upload {
    color: var(--dark-accent-primary) !important;
    filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.5));
}

/* Progress bars */
.progress {
    background-color: var(--dark-bg-3) !important;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    background: var(--dark-gradient-primary) !important;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

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

/* Alerts */
.alert {
    background: var(--dark-bg-2) !important;
    border: 1px solid var(--dark-border-default) !important;
    color: var(--dark-text-primary) !important;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    color: var(--dark-accent-success) !important;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: var(--dark-accent-danger) !important;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    color: var(--dark-accent-warning) !important;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
    color: var(--dark-accent-primary) !important;
}

/* Tables */
.table,
.dark-table {
    color: var(--dark-text-primary) !important;
    background: transparent !important;
}

.table > thead,
.dark-table > thead {
    background: var(--dark-bg-3);
    color: var(--dark-text-secondary);
}

.table > thead > tr > th,
.dark-table > thead > tr > th {
    border-color: var(--dark-border-default) !important;
    background: var(--dark-bg-3) !important;
    color: var(--dark-text-secondary) !important;
}

.table > tbody,
.dark-table > tbody {
    background: transparent !important;
}

.table > tbody > tr,
.dark-table > tbody > tr {
    border-color: var(--dark-border-subtle) !important;
    background: transparent !important;
}

.table > tbody > tr > td,
.dark-table > tbody > tr > td {
    background: transparent !important;
    color: var(--dark-text-primary) !important;
    border-color: var(--dark-border-subtle) !important;
}

.table > tbody > tr:hover,
.dark-table > tbody > tr:hover {
    background: var(--dark-bg-2) !important;
}

.table > tbody > tr:hover > td,
.dark-table > tbody > tr:hover > td {
    background: var(--dark-bg-2) !important;
}

/* Badges */
.badge {
    font-weight: 500;
}

.badge.bg-primary {
    background: var(--dark-gradient-primary) !important;
}

.badge.bg-success {
    background: rgba(16, 185, 129, 0.2) !important;
    /* Removed color to use white text instead of green on green */
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge.bg-danger {
    background: rgba(239, 68, 68, 0.2) !important;
    color: var(--dark-accent-danger) !important;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* File items */
.file-item,
.list-group-item {
    background: var(--dark-bg-1) !important;
    border: 1px solid var(--dark-border-subtle) !important;
    color: var(--dark-text-primary) !important;
    transition: all var(--transition-base);
}

.file-item:hover,
.list-group-item:hover {
    background: var(--dark-bg-2) !important;
    border-color: var(--dark-border-default) !important;
    transform: translateX(4px);
}

/* Stats cards */
.stat-card {
    background: var(--dark-gradient-surface) !important;
    border: 1px solid var(--dark-border-subtle) !important;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--dark-gradient-primary);
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    transition: opacity var(--transition-base);
}

.stat-card:hover::before {
    opacity: 0.3;
}

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

.animate-fadeIn {
    animation: fadeIn 0.6s ease-out;
}

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

.animate-pulse {
    animation: pulse 2s infinite;
}

/* Glow effects */
.glow-text {
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.8);
}

.glow-box {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.3) !important;
}

/* Utility classes */
.text-muted {
    color: var(--dark-text-muted) !important;
}

.text-secondary {
    color: var(--dark-text-secondary) !important;
}

.border {
    border-color: var(--dark-border-default) !important;
}

.border-bottom {
    border-bottom-color: var(--dark-border-default) !important;
}

/* Modal overrides */
.modal-content {
    background: var(--dark-bg-2) !important;
    border: 1px solid var(--dark-border-default) !important;
    color: var(--dark-text-primary) !important;
}

.modal-header {
    border-bottom-color: var(--dark-border-default) !important;
}

.modal-footer {
    border-top-color: var(--dark-border-default) !important;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Footer */
.site-footer {
    background: var(--dark-bg-1);
    margin-top: 4rem;
    position: relative;
}

.site-footer .footer-accent-border {
    height: 3px;
    background: var(--dark-gradient-primary);
    width: 100%;
}

.site-footer .container {
    padding-top: 3rem;
    padding-bottom: 1.5rem;
}

/* Footer Main - Three Column Layout */
.site-footer .footer-main {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--dark-border-subtle);
}

/* Left Column - Brand Section */
.site-footer .footer-brand-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.site-footer .footer-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--dark-text-primary);
    font-weight: 700;
    font-size: 1.25rem;
}

.site-footer .footer-brand .material-icons-outlined {
    font-size: 28px;
    background: var(--dark-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.site-footer .footer-tagline {
    color: var(--dark-text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
    max-width: 280px;
}

/* Security Badges */
.site-footer .footer-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.site-footer .footer-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: var(--dark-bg-2);
    border: 1px solid var(--dark-border-subtle);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--dark-text-secondary);
    transition: all var(--transition-fast);
}

.site-footer .footer-badge:hover {
    border-color: var(--dark-accent-primary);
    background: rgba(59, 130, 246, 0.1);
}

.site-footer .footer-badge .material-icons-outlined {
    font-size: 14px;
    color: var(--dark-accent-primary);
}

/* Center Column - Navigation */
.site-footer .footer-nav-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.site-footer .footer-nav-title {
    color: var(--dark-text-primary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.site-footer .footer-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.site-footer .footer-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dark-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    padding: 0.25rem 0;
}

.site-footer .footer-nav a .material-icons-outlined {
    font-size: 18px;
    transition: transform var(--transition-fast);
}

.site-footer .footer-nav a:hover {
    color: var(--dark-accent-primary);
}

.site-footer .footer-nav a:hover .material-icons-outlined {
    transform: translateX(3px);
}

/* Right Column - Kiora Attribution */
.site-footer .footer-kiora-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}

.site-footer .footer-service-by {
    color: var(--dark-text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.site-footer .footer-kiora-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--dark-bg-2);
    border: 1px solid var(--dark-border-default);
    border-radius: 8px;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.site-footer .footer-kiora-link:hover {
    background: var(--dark-bg-3);
    border-color: var(--dark-accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.site-footer .footer-kiora-link .kiora-logo {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.site-footer .footer-kiora-link .material-icons-outlined {
    font-size: 16px;
    color: var(--dark-text-muted);
    transition: color var(--transition-fast);
}

.site-footer .footer-kiora-link:hover .material-icons-outlined {
    color: var(--dark-accent-primary);
}

.site-footer .footer-kiora-description {
    color: var(--dark-text-muted);
    font-size: 0.8rem;
    margin: 0;
    font-style: italic;
}

/* Footer Bottom Bar */
.site-footer .footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
}

.site-footer .footer-copyright {
    color: var(--dark-text-muted);
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 992px) {
    .site-footer .footer-main {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    .site-footer .footer-brand-section {
        grid-column: 1 / -1;
    }

    .site-footer .footer-badges {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .display-title {
        font-size: 2.5rem;
    }

    .container-main {
        padding: 1rem !important;
    }

    .site-footer .footer-main {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .site-footer .footer-brand-section {
        align-items: center;
    }

    .site-footer .footer-tagline {
        max-width: 100%;
    }

    .site-footer .footer-badges {
        justify-content: center;
    }

    .site-footer .footer-nav-section {
        align-items: center;
    }

    .site-footer .footer-nav {
        align-items: center;
    }

    .site-footer .footer-kiora-section {
        align-items: center;
    }

    .site-footer .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}