/* ==========================================================================
   Modernes CSS für Download-Tool (Frontend & Backend)
   ========================================================================== */

:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #eff6ff;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
    font-family: var(--font);
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--gray-900);
    font-weight: 700;
    font-size: 1.25rem;
}

.brand-icon {
    width: 34px;
    height: 34px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-icon svg {
    width: 20px;
    height: 20px;
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--gray-600);
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.15s;
}

.nav-links a:hover {
    color: var(--primary);
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */
.main-container {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1.25rem;
    flex: 1;
    width: 100%;
}

.page-hero {
    text-align: center;
    margin-bottom: 2.5rem;
}

.page-hero h1 {
    font-size: 2.25rem;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.page-hero p {
    color: var(--gray-500);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ==========================================================================
   Cards & Panels
   ========================================================================== */
.card {
    background: #ffffff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem;
    margin-bottom: 1.75rem;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

/* Download Single Page Card */
.download-hero-card {
    max-width: 580px;
    margin: 3rem auto;
    text-align: center;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.download-hero-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 20px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-hero-icon svg {
    width: 44px;
    height: 44px;
}

.download-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.download-description {
    color: var(--gray-600);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.file-meta-box {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    justify-content: space-around;
    margin-bottom: 1.75rem;
    font-size: 0.875rem;
}

.file-meta-item {
    display: flex;
    flex-direction: column;
}

.file-meta-label {
    color: var(--gray-400);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
}

.file-meta-value {
    color: var(--gray-800);
    font-weight: 600;
}

/* ==========================================================================
   Buttons & Inputs
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    line-height: 1.2;
}

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

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

.btn-secondary {
    background-color: white;
    border-color: var(--gray-300);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background-color: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-danger {
    background-color: var(--danger-light);
    color: var(--danger);
    border-color: #fecaca;
}

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

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.825rem;
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1.1rem;
    width: 100%;
}

.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.4rem;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background-color: white;
    color: var(--gray-900);
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-helper {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 0.35rem;
}

/* ==========================================================================
   File List / Grid
   ========================================================================== */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.file-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s, box-shadow 0.15s;
}

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

.file-card-top {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.file-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-card-icon svg {
    width: 26px;
    height: 26px;
}

.file-card-info {
    flex: 1;
    min-width: 0;
}

.file-card-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card-desc {
    font-size: 0.85rem;
    color: var(--gray-500);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.file-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--gray-100);
}

/* ==========================================================================
   Badges & Tags
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-gray {
    background: var(--gray-100);
    color: var(--gray-600);
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

/* ==========================================================================
   Dropzone (Upload)
   ========================================================================== */
.upload-dropzone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: var(--gray-50);
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    position: relative;
}

.upload-dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
    color: var(--gray-400);
}

.upload-icon svg {
    width: 100%;
    height: 100%;
}

.upload-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.upload-subtitle {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.upload-progress {
    display: none;
    margin-top: 1.25rem;
}

.progress-bar-container {
    height: 8px;
    background: var(--gray-200);
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.2s ease;
}

/* ==========================================================================
   Admin Table
   ========================================================================== */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th {
    background: var(--gray-50);
    padding: 0.75rem 1rem;
    color: var(--gray-600);
    font-weight: 600;
    border-bottom: 1px solid var(--gray-200);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: var(--gray-50);
}

.data-table tr.link-subrow:hover td {
    background: var(--gray-50);
}

.data-table tr.link-subrow td {
    padding-top: 0.25rem;
    padding-bottom: 1.1rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.stat-val {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* ==========================================================================
   Modals & Toast
   ========================================================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(3px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--gray-400);
}

.modal-close:hover {
    color: var(--gray-700);
}

/* Toast Message */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--gray-900);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   SVG File Icons Colors
   ========================================================================== */
.file-icon {
    width: 24px;
    height: 24px;
}
.icon-pdf { color: #ef4444; }
.icon-archive { color: #f59e0b; }
.icon-image { color: #8b5cf6; }
.icon-audio { color: #ec4899; }
.icon-video { color: #06b6d4; }
.icon-doc { color: #2563eb; }
.icon-sheet { color: #10b981; }
.icon-default { color: #64748b; }

/* Responsive */
@media (max-width: 768px) {
    .site-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    .data-table {
        display: block;
    }
}
