/* TPFotos - Dark Mode Styles, GLAESS Branding */

:root {
    --primary: #005A9C;
    --primary-light: #0070c0;
    --accent: #E8A000;
    --accent-light: #f0b830;
    --bg: #1a1a1a;
    --card: #2a2a2a;
    --card-hover: #333;
    --text: #e0e0e0;
    --text-muted: #888;
    --border: #3a3a3a;
    --danger: #dc3545;
    --danger-hover: #c82333;
    --success: #28a745;
    --input-bg: #222;
    --radius: 8px;
}

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

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

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-light);
}

/* --- Navbar --- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav-brand {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-decoration: none;
}

.brand-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 2px;
}

.brand-sub {
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: transform 0.2s;
}

.nav-links {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    flex-direction: column;
}

.nav-links.open {
    display: flex;
}

.nav-link {
    display: block;
    padding: 12px 20px;
    color: var(--text);
    font-size: 0.95rem;
    transition: background 0.15s;
}

.nav-link:hover,
.nav-link.active {
    background: var(--border);
    color: var(--accent);
}

.nav-logout {
    color: var(--danger);
}

/* --- Container --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* --- Flash Messages --- */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.flash-success {
    background: rgba(40, 167, 69, 0.15);
    border: 1px solid var(--success);
    color: var(--success);
}

.flash-error {
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.flash-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

/* --- Login --- */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo .brand-name {
    font-size: 2rem;
}

.login-logo .brand-sub {
    font-size: 0.75rem;
    display: block;
    margin-top: 4px;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-group .required::after {
    content: ' *';
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    min-height: 48px;
    text-decoration: none;
}

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

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

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

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

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

.btn-danger {
    background: var(--danger);
    color: #fff;
}

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

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

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

.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
    min-height: 36px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* --- Upload Preview --- */
.file-input-wrapper {
    position: relative;
}

.file-input-wrapper input[type="file"] {
    display: none;
}

.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: var(--input-bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s;
    min-height: 60px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.file-label:hover {
    border-color: var(--accent);
    color: var(--text);
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 16px 0;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--input-bg);
}

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

.preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.preview-remove:hover {
    background: var(--danger);
}

/* --- Progress Bar --- */
.progress-wrapper {
    display: none;
    margin: 16px 0;
}

.progress-wrapper.active {
    display: block;
}

.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    width: 0%;
    transition: width 0.2s;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
}

/* --- Galerie Filter --- */
.filter-bar {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.result-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* --- Foto Grid (Galerie) --- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.photo-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.15s;
}

.photo-card:hover {
    border-color: var(--accent);
}

.photo-thumb {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-info {
    padding: 10px 12px;
}

.photo-auftrag {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.photo-actions {
    display: flex;
    gap: 6px;
    padding: 0 12px 10px;
}

.photo-actions .btn-sm {
    padding: 6px 10px;
    font-size: 0.8rem;
    min-height: 32px;
}

/* --- Detail --- */
.detail-image {
    text-align: center;
    margin-bottom: 20px;
}

.detail-image img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius);
}

.meta-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.meta-table th,
.meta-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.meta-table th {
    color: var(--text-muted);
    font-weight: 500;
    width: 35%;
    white-space: nowrap;
}

.meta-table td {
    word-break: break-word;
}

.meta-table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.json-display {
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    overflow-x: auto;
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 20px;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
}

.pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.pagination .current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state p {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

/* --- Footer --- */
.app-footer {
    text-align: center;
    padding: 20px 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* --- Section Title --- */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--accent);
}

/* --- Desktop --- */
@media (min-width: 768px) {
    .nav-toggle {
        display: none;
    }

    .nav-links {
        display: flex;
        position: static;
        flex-direction: row;
        background: none;
        border: none;
        padding: 0;
        gap: 4px;
    }

    .nav-link {
        padding: 8px 16px;
        border-radius: var(--radius);
    }

    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .photo-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .preview-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .meta-table th {
        width: 25%;
    }
}
