/*
 * DW File Browser – Minimal Style
 */

:root {
    --color-bg: #0a0a0b;
    --color-surface: #141417;
    --color-border: #222228;
    --color-text: #fafafa;
    --color-text-muted: #71717a;
    --color-accent: #6366f1;
    --color-accent-hover: #818cf8;
    --color-error: #ef4444;
    
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', monospace;
    
    --radius: 0.5rem;
    --transition: 150ms ease;
    
    /* Safe Areas für iPhone Notch/Home Indicator */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height für iOS */
    overscroll-behavior: none;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.container {
    max-width: 64rem;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    padding-top: calc(2rem + var(--safe-top));
    padding-bottom: calc(2rem + var(--safe-bottom));
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOCKSCREEN WRAPPER (für iOS)
   ═══════════════════════════════════════════════════════════════════════════ */

.lockscreen-wrapper {
    position: fixed;
    inset: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOCKSCREEN (iPhone-Style PIN)
   ═══════════════════════════════════════════════════════════════════════════ */

.lockscreen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1.5rem 1rem;
    padding-top: calc(1.5rem + var(--safe-top));
    padding-bottom: calc(1.5rem + var(--safe-bottom));
    background: linear-gradient(145deg, #1a1a2e 0%, #0a0a0b 50%, #1a0a1a 100%);
}

.lockscreen__content {
    width: 100%;
    max-width: 18rem;
    text-align: center;
}

.lockscreen__time {
    font-size: clamp(3.5rem, 12vw, 5rem);
    font-weight: 200;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.lockscreen__date {
    font-size: clamp(0.9rem, 3vw, 1.125rem);
    font-weight: 400;
    color: var(--color-text-muted);
    margin-bottom: clamp(1.5rem, 5vh, 3rem);
}

.pin-container {
    padding-top: 0.5rem;
}

.pin-title {
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

/* PIN Dots */
.pin-dots {
    display: flex;
    justify-content: center;
    gap: 0.875rem;
    margin-bottom: 1.5rem;
}

.pin-dot {
    width: 0.8125rem;
    height: 0.8125rem;
    border-radius: 50%;
    border: 2px solid var(--color-text-muted);
    background: transparent;
    transition: all 0.15s ease;
}

.pin-dot.filled {
    background: var(--color-text);
    border-color: var(--color-text);
    transform: scale(1.1);
}

/* Shake Animation bei falschem PIN */
.pin-dots.shake {
    animation: shake 0.5s ease-in-out;
}

.pin-dots.shake .pin-dot {
    border-color: var(--color-error);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
}

/* Numpad */
.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(0.625rem, 2vw, 0.875rem);
    max-width: 16rem;
    margin: 0 auto;
}

.numpad__key {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    width: 100%;
    max-width: 4.5rem;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 50%;
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.numpad__key:hover {
    background: rgba(255, 255, 255, 0.15);
}

.numpad__key:active {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0.92);
}

.numpad__key--empty {
    background: transparent;
    cursor: default;
    pointer-events: none;
}

.numpad__key--empty:hover {
    background: transparent;
}

.numpad__key--delete {
    background: transparent;
}

.numpad__key--delete:hover {
    background: rgba(255, 255, 255, 0.08);
}

.numpad__key--delete svg {
    opacity: 0.7;
    width: 1.25rem;
    height: 1.25rem;
}

.numpad__num {
    font-size: clamp(1.5rem, 5vw, 1.75rem);
    font-weight: 300;
    line-height: 1;
}

.numpad__letters {
    font-size: 0.5625rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-top: 0.125rem;
}

/* Responsive für kleine Screens */
@media (max-height: 600px) {
    .lockscreen__time {
        font-size: 3rem;
    }
    
    .lockscreen__date {
        margin-bottom: 1rem;
    }
    
    .pin-dots {
        margin-bottom: 1rem;
    }
    
    .numpad {
        gap: 0.5rem;
    }
    
    .numpad__key {
        max-width: 3.5rem;
    }
    
    .numpad__num {
        font-size: 1.25rem;
    }
    
    .numpad__letters {
        display: none;
    }
}

/* Legacy Styles für Formular (hidden) */
.btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: white;
    background: var(--color-accent);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════════════════ */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

.breadcrumb__root {
    font-weight: 600;
    color: var(--color-accent);
}

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

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

.breadcrumb__item:hover {
    color: var(--color-text);
}

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

.logout:hover {
    color: var(--color-error);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FILE LIST
   ═══════════════════════════════════════════════════════════════════════════ */

.file-list {
    width: 100%;
    border-collapse: collapse;
}

.file-list th {
    text-align: left;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.file-list td {
    padding: 0.625rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.file-list__row:hover {
    background: var(--color-surface);
}

.file-list__name {
    width: 60%;
}

.file-list__size,
.file-list__date {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    font-family: var(--font-mono);
    white-space: nowrap;
}

.file-list__size {
    width: 15%;
    text-align: right;
}

.file-list__date {
    width: 25%;
    text-align: right;
}

.file-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color var(--transition);
}

.file-link:hover {
    color: var(--color-accent);
}

.file-link--dir {
    font-weight: 500;
}

.file-icon {
    font-size: 1rem;
    line-height: 1;
}

.empty {
    text-align: center;
    color: var(--color-text-muted);
    padding: 3rem 1rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }
    
    .file-list__date {
        display: none;
    }
    
    .file-list__name {
        width: 75%;
    }
    
    .file-list__size {
        width: 25%;
    }
    
    .file-list th,
    .file-list td {
        padding: 0.5rem 0.75rem;
    }
}
