/* Modern CSS Reset and Variables */
:root {
  --primary-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-bg: rgba(30, 30, 45, 0.95);
  --card-bg: rgba(20, 25, 40, 0.95);
  --accent-color: #8b5cf6;
  --accent-hover: #7c3aed;
  --success-color: #10b981;
  --error-color: #ef4444;
  --text-dark: #f8fafc;
  --text-light: #e2e8f0;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

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

/* Prevent text cursor and selection on non-input elements */
body, h1, h2, h3, h4, h5, h6, p, div, span, a, button, label {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Allow selection on specific elements that should be selectable */
input, textarea, [contenteditable="true"] {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Custom cursors */
html, body {
    cursor: url('/cursor.cheeze.svg') 0 20, auto;
}

a, button, input[type="submit"], .button, th, 
label[for="fileInput"], #dragDropArea.dragover, select, option {
    cursor: url('/cursor-hover.cheeze.svg') 0 0, pointer !important;
}

:not(input):not(textarea):not(select) {
    cursor: url('/cursor.cheeze.svg') 0 20, auto;
}

:not(input):not(textarea):not(select):active {
    cursor: url('/cursor-hover.cheeze.svg') 0 0, text !important;
}

body {
    min-height: 100vh;
    background: var(--primary-bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(139, 92, 246, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(168, 85, 247, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 600px;
    padding: 2rem;
}

/* Modern card design */
#dragDropArea {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 2px dashed transparent;
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    margin: 1rem 0;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    position: relative;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#dragDropArea::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(168, 85, 247, 0.06) 100%);
    border-radius: var(--radius-xl);
    z-index: -1;
}

#dragDropArea.dragover {
    border-color: var(--accent-color);
    background: rgba(139, 92, 246, 0.15);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(139, 92, 246, 0.4);
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent-color) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

#message {
    font-size: 1.125rem;
    color: var(--text-light);
    margin: 1rem 0;
    line-height: 1.6;
}

/* Modern button design */
.button {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit; /* Ensure buttons inherit the body font */
    border-radius: var(--radius-lg);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    margin: 0.5rem;
    min-width: 140px;
    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.2), transparent);
    transition: left 0.5s;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--accent-hover) 0%, #6d28d9 100%);
}

.button:hover::before {
    left: 100%;
}

.button:active {
    transform: translateY(0);
}

/* Form styling */
form {
    width: 100%;
}

button[type="submit"] {
    font-family: inherit; /* Ensure submit buttons also inherit font */
}

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 1rem;
    margin: 0.5rem 0 1rem 0;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: rgba(30, 35, 50, 0.8);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    color: var(--text-light);
}

input[type="text"]:focus, input[type="password"]:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    background: rgba(35, 40, 55, 0.9);
}

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

label {
    display: block;
    text-align: left;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

/* Progress bar */
.progress-bar {
    width: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    margin-top: 1rem;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-bar-fill {
    height: 24px;
    width: 0;
    background: linear-gradient(90deg, var(--success-color) 0%, #38a169 100%);
    border-radius: var(--radius-lg);
    text-align: center;
    color: white;
    line-height: 24px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(45deg, transparent 33%, rgba(255, 255, 255, 0.1) 33%, rgba(255, 255, 255, 0.1) 66%, transparent 66%);
    background-size: 30px 30px;
    animation: move 1s linear infinite;
}

@keyframes move {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 30px 30px;
    }
}

/* Position utilities */
.top-right {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 100;
}

.top-left {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 100;
}

.bottom-right {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 100;
}

.bottom-left {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 100;
}

/* Status colors */
.red {
    background: linear-gradient(135deg, var(--error-color) 0%, #e53e3e 100%) !important;
}

.red:hover {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%) !important;
}

.bold {
    font-weight: 700;
}

/* Links */
.hidelink {
    color: inherit;
    text-decoration: none;
    transition: all 0.3s ease;
}

.hidelink:hover {
    transform: scale(1.02);
}

a:not(.button):not(.hidelink) {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

a:not(.button):not(.hidelink):hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Upload speed indicator */
#uploadSpeed {
    color: var(--success-color);
    font-weight: 600;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    text-align: center;
}

/* Stats display styling for home page */
#stats-display {
    pointer-events: auto;
}

#stats-display .stats-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 140px;
}

#stats-display .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.5rem;
}

#stats-display .stat-item:last-child {
    margin-bottom: 0;
}

#stats-display .stat-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
    line-height: 1.2;
    transition: all 0.3s ease;
}

#stats-display .stat-number.counting {
    color: var(--success-color);
    transform: scale(1.1);
}

#stats-display .stat-number.loading {
    background: linear-gradient(90deg, var(--text-muted) 25%, var(--accent-color) 50%, var(--text-muted) 75%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 1.5s ease-in-out infinite;
}

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

#stats-display .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Error messages */
#error-message {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 1rem;
    font-weight: 500;
}

/* Table styling for dashboard */
table {
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-top: 2rem;
    border-collapse: collapse;
}

th {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    color: white;
    padding: 1rem;
    font-weight: 600;
    text-align: left;
    transition: all 0.3s ease;
    position: relative;
    user-select: none;
}

th:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, #6d28d9 100%);
    transform: translateY(-1px);
}

td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    word-wrap: break-word;
    overflow-wrap: break-word;
    vertical-align: top;
}

tbody tr {
    transition: all 0.3s ease;
}

tbody tr:hover {
    background: rgba(139, 92, 246, 0.08);
    transform: translateX(4px);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Sort arrows */
.sort-arrow {
    display: none;
    margin-left: 0.5rem;
    opacity: 0.7;
}

.sort-arrow.active {
    display: inline-block;
    opacity: 1;
}

.sort-arrow.asc:after {
    content: '▲';
}

.sort-arrow.desc:after {
    content: '▼';
}

/* Overlay effects */
#mainContent.blurred {
    filter: blur(5px);
    pointer-events: none;
}

#dropOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 2rem;
    font-weight: 600;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#dropOverlay.visible {
    opacity: 1;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        max-width: 95%;
    }
    
    #dragDropArea {
        padding: 2rem 1rem;
        min-height: 250px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .button {
        width: 100%;
        margin: 0.25rem 0;
    }
    
    .top-right, .top-left, .bottom-right, .bottom-left {
        position: relative;
        top: auto;
        right: auto;
        bottom: auto;
        left: auto;
        margin: 0.5rem;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.75rem;
    }
    
    #dragDropArea {
        padding: 1.5rem 1rem;
        min-height: 200px;
    }
    
    .button {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }
}

/* Animation enhancements */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.container {
    animation: fadeInUp 0.6s ease-out;
}

/* Loading states - exclude stat-number elements to avoid conflicts */
.loading:not(.stat-number) {
    position: relative;
    pointer-events: none;
}

.loading:not(.stat-number)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Focus states for accessibility */
.button:focus,
input:focus,
th:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Enhance drag and drop visual feedback */
#uploadForm.dragover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(139, 92, 246, 0.4);
}

.highlight {
    border: 3px dashed var(--accent-color) !important;
    background: rgba(139, 92, 246, 0.1) !important;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Upload Mode Dropdown Styles */
.upload-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
    width: 100%;
    margin-top: 1.5rem;
}

.upload-mode-container {
    flex: 0 0 auto;
    max-width: 4rem;
}

.select-wrapper {
    position: relative;
    width: 4rem;
}

.upload-controls .button {
    margin: 0;
}

.select-wrapper::after {
    content: '▼';
    position: absolute;
    top: 50%;
    right: 0.75rem;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--accent-color);
    font-size: 0.7rem;
    transition: all 0.3s ease;
}

.upload-mode-select {
    width: 100%;
    padding: 0.6rem 2rem 0.6rem 0.75rem;
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 500;
    cursor: url('/cursor-hover.cheeze.svg') 0 0, pointer !important;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    backdrop-filter: blur(10px);
    outline: none;
}

.upload-mode-select * {
    cursor: url('/cursor-hover.cheeze.svg') 0 0, pointer !important;
}

.upload-mode-select:hover {
    border-color: rgba(139, 92, 246, 0.4);
    background: rgba(30, 30, 45, 0.8);
}

.upload-mode-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.select-wrapper:hover::after {
    color: var(--accent-hover);
}

.upload-mode-select option {
    background: #1a1f30 !important;
    color: var(--text-light) !important;
    padding: 0.5rem;
    font-size: 0.8rem;
    cursor: url('/cursor-hover.cheeze.svg') 0 0, pointer !important;
}

.upload-mode-select option:hover {
    background: rgba(139, 92, 246, 0.3) !important;
    color: #fff !important;
    cursor: url('/cursor-hover.cheeze.svg') 0 0, pointer !important;
}

.upload-mode-select option:checked {
    background: rgba(139, 92, 246, 0.4) !important;
    color: #fff !important;
    cursor: url('/cursor-hover.cheeze.svg') 0 0, pointer !important;
}

.upload-mode-select option:disabled {
    color: var(--text-muted);
    opacity: 0.5;
    background: #1a1f30;
    cursor: not-allowed !important;
}

/* Warning message animation */
#modeWarning {
    animation: slideDown 0.3s ease-out;
}

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