/**
 * My-Player.Rocks SyncServer - Zentrales Stylesheet
 *
 * @version 2.0.0
 * @author My-Player.Rocks Team
 * @license MIT
 */

/* ==================== CSS Variables ==================== */
:root {
    --primary: #E50914;
    --primary-hover: #c40812;
    --bg-dark: #000000;
    --bg-card: #1a1a1a;
    --bg-sidebar: #0a0a0a;
    --text-light: #eeeeee;
    --text-muted: #aaaaaa;
    --border-color: #333333;
}

/* ==================== Base Styles ==================== */
body {
    background: var(--bg-dark);
    color: var(--text-light);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

/* Hinweis: Login/Welcome/Error Pages verwenden inline Styles im <head> */
/* für Zentrierung und Button-Farben, da dies spezifischer sein muss */

/* Bootstrap btn-primary überschreiben für unsere Pages */
.btn-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--text-light) !important;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    color: var(--text-light) !important;
}

/* ==================== Sidebar ==================== */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
}

.sidebar-brand {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.sidebar-logo {
    width: 50px;
    height: 50px;
}

.sidebar-brand-text {
    font-weight: 700;
    color: var(--text-light);
    font-size: 0.95rem;
}

.sidebar-brand-sub {
    font-size: 0.75rem;
    color: #666666;
}

.sidebar-nav {
    padding: 0;
}

.nav-item-custom {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item-custom:hover {
    background: #1a1a1a;
    color: var(--text-light);
}

.nav-item-custom.active {
    background: var(--primary);
    color: var(--text-light);
    border-left-color: #fff;
}

.nav-item-custom i {
    width: 20px;
    text-align: center;
}

.sidebar-logout {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    background: var(--primary);
    border-radius: 8px;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--primary-hover);
    color: var(--text-light);
}

/* ==================== Main Content ==================== */
.main-content {
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==================== Header ==================== */
.top-header {
    background: var(--bg-dark);
    border-bottom: 2px solid var(--primary);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 99;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
}

.header-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Hamburger-Button: nur auf Mobile sichtbar (siehe Responsive-Block) */
.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-light);
    font-size: 1.1rem;
    cursor: pointer;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus {
    background: #1a1a1a;
    color: var(--primary);
}

/* Abdunkelung hinter der Sidebar, wenn sie mobil als Drawer geöffnet ist */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
}

.sidebar-overlay.show {
    display: block;
}

.header-logo {
    width: 28px;
    height: 28px;
}

.header-title {
    margin: 0;
    font-size: 1.3rem;
    color: var(--text-light);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.datetime {
    text-align: right;
}

.datetime-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.datetime-time {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-light);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #222222;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==================== Content Area ==================== */
.content-area {
    padding: 30px;
    flex: 1;
}

/* ==================== Cards ==================== */
.card-custom {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 30px;
}

.card-title {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ==================== Tables ==================== */
.table-custom {
    width: 100%;
    background: #141414;
    border-collapse: collapse;
}

.table-custom th {
    background: #000000;
    color: var(--primary);
    font-weight: 600;
    padding: 12px;
    border: 1px solid var(--border-color);
}

.table-custom td {
    padding: 12px;
    border: 1px solid var(--border-color);
    color: var(--text-light);
}

.table-custom tr:nth-child(even) {
    background: #1a1a1a;
}

/* ==================== Forms ==================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-control-custom {
    background: #222222;
    border: 1px solid var(--border-color);
    color: var(--text-light);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    width: 100%;
    font-size: 0.95rem;
}

.form-control-custom:focus {
    background: #2a2a2a;
    border-color: var(--primary);
    color: var(--text-light);
    box-shadow: 0 0 0 0.25rem rgba(229, 9, 20, 0.25);
    outline: none;
}

.form-control-custom::placeholder {
    color: #666666;
}

.form-control-custom:disabled,
.form-control-custom[readonly] {
    background: #2a2a2a;
    cursor: not-allowed;
    opacity: 0.7;
}

.form-label-custom {
    display: block;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-label-required::after {
    content: " *";
    color: var(--primary);
}

.form-hint {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.35rem;
}

.form-check-custom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.form-check-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-check-label {
    color: var(--text-light);
    font-size: 0.95rem;
    cursor: pointer;
    margin: 0;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 640px) {
    .form-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

/* Form Card */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 2rem;
    max-width: 700px;
}

.form-card-wide {
    max-width: 100%;
}

.form-card-title {
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

/* ==================== Buttons ==================== */
.btn-custom-primary {
    background: var(--primary);
    border: 1px solid var(--primary);
    color: var(--text-light);
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-custom-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--text-light);
}

.btn-custom-secondary {
    background: #333333;
    border: 1px solid #444444;
    color: var(--text-light);
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-custom-secondary:hover {
    background: #444444;
    color: var(--text-light);
}

.btn-custom-danger {
    background: #b71c1c;
    border: 1px solid #b71c1c;
    color: var(--text-light);
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-custom-danger:hover {
    background: #c62828;
}

/* ==================== Alerts ==================== */
.alert-custom {
    background: rgba(229, 9, 20, 0.15);
    border: 1px solid var(--primary);
    color: #ff6b6b;
}

.alert-success-custom {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid #22c55e;
    color: #86efac;
}

/* ==================== Login Page ==================== */
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.logo-container {
    text-align: center;
    margin-bottom: 1.5rem;
}

.logo-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
}

.login-title {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* ==================== Welcome Page ==================== */
.welcome-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    max-width: 500px;
}

.api-info {
    background: #222;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
    text-align: left;
}

.api-info code {
    color: #22d3ee;
    background: #111;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

/* ==================== Error Pages ==================== */
.error-card {
    text-align: center;
    padding: 3rem;
}

.error-code {
    font-size: 8rem;
    color: var(--primary);
    font-weight: 700;
}

/* ==================== Footer ==================== */
footer {
    background: #0a0a0a;
    border-top: 1px solid #333;
    padding: 20px 30px;
    text-align: center;
}

/* ==================== Block Reason Tooltip ==================== */
.block-reason-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin-bottom: 4px;
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
        width: min(260px, 82vw);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    /* Kopfbereich: darf bei Bedarf in zweite Zeile umbrechen (Datum/Uhrzeit/Status) */
    .top-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .header-title {
        font-size: 1.05rem;
    }

    .header-right {
        gap: 12px;
    }

    .content-area {
        padding: 16px;
    }

    .card-custom {
        padding: 16px;
    }

    .form-card {
        padding: 1.25rem;
        max-width: 100%;
    }

    /* Häufigstes Seiten-Kopf-Muster (Titel + Aktions-Button) nicht quetschen,
       sondern bei Platzmangel umbrechen lassen */
    .d-flex {
        flex-wrap: wrap;
        row-gap: 10px;
    }

    /* Bootstrap-Pagination würde sonst horizontal aus dem Viewport laufen */
    .pagination {
        flex-wrap: wrap;
        row-gap: 6px;
    }

    /* Etwas grosszuegigere Touch-Targets fuer Buttons und Inputs */
    .btn-custom-primary,
    .btn-custom-secondary,
    .btn-custom-danger {
        padding: 0.65rem 1.15rem;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 0.95rem;
    }

    .datetime-date {
        display: none;
    }
}

/* ==================== Utility Classes ==================== */
.text-primary {
    color: var(--primary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-light {
    color: var(--text-light) !important;
}

.bg-dark {
    background: var(--bg-dark) !important;
}

.bg-card {
    background: var(--bg-card) !important;
}

.border-color {
    border-color: var(--border-color) !important;
}
