/**
 * Jugendweihe Dateimanagement - Stylesheet
 * Corporate Design basierend auf www.jugendweihe.de
 * Mobile First Ansatz
 */

/* ============================================
   CSS CUSTOM PROPERTIES (Variablen)
   ============================================ */
:root {
    /* Farben aus jugendweihe.de */
    --color-primary: #2A9D8F;        /* Hauptgrün/Teal */
    --color-primary-dark: #21867a;
    --color-primary-light: #3dbfb0;
    --color-secondary: #264653;      /* Dunkles Anthrazit */
    --color-accent: #E9C46A;         /* Gelb/Gold */
    --color-accent-pink: #E76F51;    /* Pink/Koralle */
    --color-accent-purple: #9B5DE5;  /* Lila */
    
    /* Hintergründe */
    --color-bg: #ffffff;
    --color-bg-light: #f5f5f5;
    --color-bg-dark: #1a1a1a;
    
    /* Text */
    --color-text: #333333;
    --color-text-light: #666666;
    --color-text-muted: #999999;
    --color-text-inverse: #ffffff;
    
    /* Status */
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-error: #EF4444;
    --color-info: #3B82F6;
    
    /* Spacing Scale (4px Basis) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    
    /* Schatten */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
    
    /* Sidebar Breite */
    --sidebar-width: 260px;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-bg-light);
    min-height: 100vh;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-dark);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, textarea, select {
    font-family: inherit;
    font-size: 16px; /* Verhindert Zoom auf iOS */
}

/* ============================================
   LAYOUT
   ============================================ */
.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar (Mobile: Drawer, Desktop: Fixed) */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: #f1f1f1;
    color: #333333;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Main Content */
.main {
    flex: 1;
    margin-left: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
    padding: var(--space-4);
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ============================================
   SIDEBAR COMPONENTS
   ============================================ */
.sidebar-header {
    padding: var(--space-5);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-logo img {
    width: 40px;
    height: 40px;
}

.sidebar-logo span {
    font-size: 1.125rem;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4);
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: var(--space-2);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: #333333;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(0,0,0,0.1);
    color: #000000;
}

.sidebar-nav .icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid rgba(0,0,0,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333333;
}

.user-role {
    font-size: 0.75rem;
    color: #555555;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    background: var(--color-bg);
    padding: var(--space-3) var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.menu-toggle {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.menu-toggle:hover {
    background: var(--color-bg-light);
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    min-height: 44px; /* Touch-Target */
    white-space: nowrap;
}

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

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

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

.btn-secondary {
    background: var(--color-bg-light);
    color: var(--color-text);
    border: 1px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #e8e8e8;
}

.btn-danger {
    background: var(--color-error);
    color: var(--color-text-inverse);
}

.btn-danger:hover {
    background: #dc2626;
    color: var(--color-text-inverse);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text);
}

.btn-ghost:hover {
    background: var(--color-bg-light);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: 0.8125rem;
    min-height: 36px;
}

.btn-lg {
    padding: var(--space-4) var(--space-5);
    font-size: 1rem;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: var(--space-4);
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-secondary);
}

.card-body {
    padding: var(--space-4);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-md);
    background: var(--color-bg);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.1);
}

.form-input.error,
.form-select.error {
    border-color: var(--color-error);
}

.form-error {
    margin-top: var(--space-2);
    font-size: 0.8125rem;
    color: var(--color-error);
}

.form-hint {
    margin-top: var(--space-2);
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* Checkbox & Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    min-height: 44px;
}

.form-check-input {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* ============================================
   ALERTS & FLASH MESSAGES
   ============================================ */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.toast {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    background: var(--color-secondary);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

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

.toast.error {
    background: var(--color-error);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================
   FOLDER GRID & CARDS
   ============================================ */
.folder-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
}

.folder-card {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

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

.folder-card-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    text-decoration: none;
    color: inherit;
    flex: 1;
}

.folder-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(42, 157, 143, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    flex-shrink: 0;
}

.folder-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    flex: 1;
    min-width: 0;
}

.folder-name {
    font-weight: 600;
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
}

.folder-meta {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.folder-actions {
    display: flex;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-4) var(--space-4);
    border-top: 1px solid #f0f0f0;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.folder-card:hover .folder-actions {
    opacity: 1;
}

.folder-action-btn {
    padding: var(--space-2);
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.folder-action-btn:hover {
    background: var(--color-bg-light);
}

/* Tablet (768px+) */
@media (min-width: 768px) {
    .folder-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .folder-card {
        display: flex;
        flex-direction: column;
    }

    .folder-card-link {
        flex: 1;
    }

    .folder-actions {
        padding-top: var(--space-3);
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .folder-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   FILE GRID & CARDS
   ============================================ */
.file-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

.file-card {
    background: var(--color-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

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

.file-preview {
    aspect-ratio: 4/3;
    background: var(--color-bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text-inverse);
}

.file-info {
    padding: var(--space-4);
}

.file-name {
    font-weight: 500;
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: var(--space-2);
}

.file-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.file-type {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-text-inverse);
}

.file-actions {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid #f0f0f0;
}

/* ============================================
   UPLOAD ZONE
   ============================================ */
.upload-zone {
    border: 2px dashed #d0d0d0;
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: center;
    transition: all var(--transition-fast);
    background: var(--color-bg);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--color-primary);
    background: rgba(42, 157, 143, 0.05);
}

.upload-zone-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    color: var(--color-text-muted);
}

.upload-zone-text {
    font-size: 1rem;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.upload-zone-hint {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: linear-gradient(135deg, #6B4C7A 0%, #2A9D8F 100%);
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--color-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    padding: var(--space-6);
    text-align: center;
    background: linear-gradient(180deg, rgba(134, 79, 161, 0.7) 2%, rgba(134, 79, 161, 0) 100%);
}

.login-logo {
    width: auto;
    height: 80px;
    margin: 0 auto var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-logo img {
    max-height: 80px;
    width: auto;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-secondary);
    margin-bottom: var(--space-2);
}

.login-subtitle {
    color: var(--color-text-muted);
    font-size: 0.9375rem;
}

.login-body {
    padding: var(--space-6);
}

.login-footer {
    padding: var(--space-4) var(--space-6);
    text-align: center;
    border-top: 1px solid #f0f0f0;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet (768px+) */
@media (min-width: 768px) {
    .content {
        padding: var(--space-5);
    }
    
    .file-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .header {
        padding: var(--space-4) var(--space-5);
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .sidebar {
        position: fixed;
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: none;
    }
    
    .main {
        margin-left: var(--sidebar-width);
    }
    
    .menu-toggle {
        display: none;
    }
    
    .content {
        padding: var(--space-6);
    }
    
    .file-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large Desktop (1280px+) */
@media (min-width: 1280px) {
    .file-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

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

.text-muted {
    color: var(--color-text-muted);
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }

.hidden {
    display: none !important;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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