:root {
    --bg-color: #f8fafc;
    --text-color: #0f172a;
    --card-bg: #ffffff;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #e2e8f0;
    --secondary-hover: #cbd5e1;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --radius: 12px;
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --card-bg: #1e293b;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --secondary: #334155;
    --secondary-hover: #475569;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
}

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

body {
    font-family: var(--font);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

main {
    flex: 1;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.text-center { text-align: center; }

/* Upload Area */
.upload-area {
    background: var(--card-bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.upload-content .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-content h2 {
    margin-bottom: 0.5rem;
}

.upload-content .hint {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #64748b;
}

.hidden { display: none !important; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-decoration: none;
    text-align: center;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
    background: var(--secondary);
    color: var(--text-color);
}
.btn-secondary:hover { background: var(--secondary-hover); }

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-small { padding: 0.4rem 0.8rem; font-size: 0.875rem; }
.btn-large { padding: 1rem 2rem; font-size: 1.125rem; }
.btn-block { display: block; width: 100%; margin-bottom: 0.5rem; }

/* Forms */
.form-group { margin-bottom: 1.5rem; }
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}
.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

/* Upload Progress */
.progress-bar-container {
    width: 100%;
    height: 12px;
    background: var(--secondary);
    border-radius: 6px;
    overflow: hidden;
    margin: 1.5rem 0 0.5rem;
}
.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.2s ease;
}

/* Copy Box */
.link-group { margin-bottom: 1.5rem; text-align: left; }
.link-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.875rem; color: #64748b; }
.copy-box {
    display: flex;
    gap: 0.5rem;
}
.copy-box input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-color);
    color: var(--text-color);
}

.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.limits {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #64748b;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: 50%;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    z-index: 100;
}

footer {
    text-align: center;
    margin-top: 3rem;
    font-size: 0.875rem;
    color: #64748b;
}
footer a { color: inherit; text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* Admin layout */
.admin-nav {
    background: var(--primary);
    color: white;
    padding: 1rem 0;
    margin-bottom: 2rem;
}
.admin-nav .nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.admin-nav a { color: white; text-decoration: none; margin-left: 1rem; opacity: 0.8; }
.admin-nav a:hover, .admin-nav a.active { opacity: 1; text-decoration: underline; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid var(--border);
}
.stat-card h3 { font-size: 0.875rem; color: #64748b; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }

.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; margin-bottom: 1rem; }
.table th, .table td { padding: 1rem; border-bottom: 1px solid var(--border); }
.table th { font-weight: 600; color: #64748b; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover { background-color: rgba(0,0,0,0.02); }
[data-theme="dark"] .table tr:hover { background-color: rgba(255,255,255,0.02); }

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.filter-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.filter-form input, .filter-form select { width: auto; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem; margin-top: 1.5rem; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal.active { display: flex; }
.modal-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}
.modal-actions { margin-top: 1.5rem; display: flex; gap: 1rem; justify-content: center; }

/* Utilities */
.alert { padding: 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-error { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .alert-error { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.alert-success { background: #dcfce3; color: #166534; }
[data-theme="dark"] .alert-success { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.text-danger { color: var(--danger); }

.highlight-text { font-size: 1.25rem; font-weight: 600; color: var(--primary); margin: 0.5rem 0; word-break: break-all; }

/* File Details page */
.file-details-grid { display: grid; grid-template-columns: 1fr 250px; gap: 2rem; }
@media (max-width: 768px) { .file-details-grid { grid-template-columns: 1fr; } }
.action-card { background: var(--secondary); padding: 1.5rem; border-radius: var(--radius); }
.action-card h3 { margin-bottom: 1rem; }
.edit-group { display: flex; justify-content: space-between; align-items: center; }

.file-cell { display: flex; align-items: center; gap: 0.5rem; }
.file-info-mini { display: flex; flex-direction: column; }
.file-name-link { font-weight: 500; color: var(--text-color); text-decoration: none; }
.file-name-link:hover { color: var(--primary); }
.file-id-mini { font-size: 0.75rem; color: #64748b; }
.action-buttons { display: flex; gap: 0.25rem; }

.image-preview { max-width: 100%; max-height: 300px; border-radius: var(--radius); object-fit: contain; margin: 1rem 0; }
.large-icon { font-size: 6rem; margin: 1rem 0; }
.file-info-card { max-width: 500px; margin: 0 auto; }
.filename-title { word-break: break-all; }
