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

:root {
    /* CI-Farben Nichtraucher-Challenge */
    --accent:      #024751;   /* Dunkelgrün/Petrol – Hauptfarbe */
    --accent-dk:   #013038;   /* Hover/aktiv */
    --accent2:     #8FB961;   /* Hellgrün – Sekundärfarbe */
    --accent2-dk:  #7aa350;   /* Hover accent2 */
    --background2: #E4F1EA;   /* Helles Mint – Karten-Hintergrund */

    /* Neutrale Web-Farben */
    --dark:        #024751;   /* Sidebar, Headlines */
    --dark2:       #013038;   /* Sidebar-Gradient */
    --text:        #1A1A1A;
    --text-light:  #6B7280;
    --border:      #D1D5DB;
    --bg:          #f5f7f5;
    --white:       #ffffff;

    /* Status-Farben */
    --success:     #008009;
    --success-bg:  #E4F1EA;
    --error:       #B11A1A;
    --error-bg:    #fde8e8;
    --info:        #1565c0;
    --info-bg:     #e8f4fd;

    --radius:      8px;
    --shadow:      0 2px 12px rgba(2,71,81,0.08);
    --shadow-md:   0 4px 24px rgba(2,71,81,0.14);
}

html { font-size: 16px; }

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

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

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark2) 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 500px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
    color: var(--white);
}
.login-logo img {
    display: block;
    width: 260px;
    height: auto;
    margin: 0 auto 10px;
    border-radius: 8px;
}
.login-logo p  { font-size: 13px; opacity: 0.6; margin-top: 4px; }

.login-box {
    background: var(--white);
    border-radius: 12px;
    padding: 36px 32px;
    box-shadow: var(--shadow-md);
}
.login-box h2 { font-size: 20px; margin-bottom: 24px; color: var(--dark); }

.login-legal {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
}
.login-legal a { color: rgba(255,255,255,0.45); }
.login-legal a:hover { color: rgba(255,255,255,0.8); text-decoration: none; }
.login-legal span { color: rgba(255,255,255,0.25); margin: 0 6px; }

.login-notice {
    margin-top: 20px;
    padding: 14px 16px;
    background: var(--background2);
    border-radius: 8px;
    font-size: 11.5px;
    color: var(--text-light);
    text-align: left;
    line-height: 1.55;
}
.login-notice p { margin-bottom: 6px; }
.login-notice p:last-child { margin-bottom: 0; }

.login-links {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
}
.login-buy {
    border-top: 1px solid var(--border);
    margin-top: 24px;
    padding-top: 24px;
    text-align: center;
}
.login-buy p { font-size: 13px; color: var(--text-light); margin-bottom: 12px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.2s;
    outline: none;
}
.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: -4px;
    margin-bottom: 26px;
    font-size: 13px;
    color: var(--text-light);
    cursor: pointer;
    user-select: none;
}
.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 11px 22px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s, transform 0.1s;
    text-align: center;
    line-height: 1.4;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: var(--accent-dk); text-decoration: none; color: var(--white); }
.btn-secondary { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.btn-secondary:hover { background: var(--accent); color: var(--white); text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-full { width: 100%; display: block; }
.btn-danger { background: #c1121f; color: var(--white); }
.btn-ghost { background: transparent; color: var(--text-light); border: 1.5px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 18px;
}
.alert-error   { background: var(--error-bg); color: var(--error); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-info    { background: var(--info-bg); color: var(--info); }
.alert-warning { background: #fff8e1; color: #b45309; }

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

/* ===== SIDEBAR ===== */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--dark);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-logo {
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
}
.sidebar-logo img {
    display: block;
    height: 40px;
    width: auto;
    max-width: 100%;
    border-radius: 5px;
}
.sidebar-logo small {
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    margin-top: 8px;
    display: block;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-nav { padding: 16px 0; flex: 1; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.65);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: var(--white);
    background: rgba(255,255,255,0.06);
    border-left-color: var(--accent2);
    text-decoration: none;
}
.sidebar-nav a.nav-download {
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    font-weight: 400;
    border-left-color: transparent;
}
.sidebar-nav a.nav-download:hover {
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.05);
    border-left-color: rgba(143,185,97,0.5);
    text-decoration: none;
}
.sidebar-nav a.nav-download svg {
    flex-shrink: 0;
    opacity: 0.6;
}
.sidebar-nav a.nav-download:hover svg { opacity: 1; }

.sidebar-nav .nav-section {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
    padding: 16px 20px 6px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 12px;
    color: rgba(255,255,255,0.35);
}
.sidebar-footer a { color: rgba(255,255,255,0.5); }
.sidebar-footer a:hover { color: var(--white); text-decoration: none; }

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
}

.page-header {
    background: var(--white);
    padding: 24px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.page-header h1 { font-size: 22px; color: var(--dark); font-weight: 700; }
.page-header p  { font-size: 14px; color: var(--text-light); margin-top: 2px; }

.page-body { padding: 32px; }

/* ===== CARDS ===== */
.card {
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 15px;
    color: var(--dark);
}
.card-body { padding: 24px; }

/* ===== COURSE GRID ===== */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 0;
}
.course-card {
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    display: block;
}
.course-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--text);
}
.course-card-locked {
    cursor: default;
    opacity: 0.8;
}
.course-card-locked:hover {
    box-shadow: var(--shadow);
    transform: none;
}
.course-card-img {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.course-card-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
}
.course-card:hover .course-card-img img {
    transform: scale(1.04);
}
.course-card-header {
    background: var(--white);
    padding: 16px 20px 8px;
}

.course-card-header h3 { font-size: 16px; font-weight: 700; margin-bottom: 2px; color: var(--text); }
.course-card-header p  { font-size: 12px; color: var(--text-light); }
.course-card-body { padding: 8px 20px 16px; }
.course-card .badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: #f0f0f0;
    color: var(--text-light);
    margin-bottom: 12px;
}

/* ===== PROGRESS BAR ===== */
.progress-bar-wrap {
    background: #eee;
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
    margin: 8px 0 4px;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent2), var(--accent));
    border-radius: 20px;
    transition: width 0.4s ease;
}
.progress-label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

/* ===== MODULE / LESSON LIST ===== */
.module-block { margin-bottom: 24px; }
.module-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    padding: 14px 20px;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}
.module-title:hover { border-color: var(--accent); }

.lesson-list { list-style: none; }
.lesson-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--white);
    border: 1px solid var(--border);
    border-top: none;
    font-size: 14px;
    transition: background 0.15s;
}
.lesson-item:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.lesson-item:hover { background: #fafafa; }
.lesson-item a {
    color: var(--text);
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}
.lesson-item a:hover { color: var(--accent); text-decoration: none; }
.lesson-item.completed a { color: var(--text-light); }
.lesson-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
}
.lesson-check.done {
    background: var(--accent2);
    border-color: var(--accent2);
    color: white;
}

/* ===== VIDEO PLAYER ===== */
/* ===== DOWNLOAD BOX ===== */
.download-box {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--background2);
    border: 1.5px solid var(--accent2);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--dark);
    transition: background 0.15s, border-color 0.15s;
}
.download-box:hover {
    background: #d4e8c8;
    border-color: var(--accent2-dk);
    text-decoration: none;
}
.download-box-icon {
    color: var(--accent2-dk);
    flex-shrink: 0;
    display: flex;
}
.download-box-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.download-box-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--accent2-dk);
}
.download-box-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}
.download-box-arrow {
    font-size: 18px;
    color: var(--accent2-dk);
    flex-shrink: 0;
}

.video-wrap {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 10px;
    background: #000;
    margin-bottom: 24px;
}
.video-wrap iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

/* ===== ABLAUF SEITE ===== */
.expired-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark2) 100%);
    padding: 20px;
}
.expired-box {
    background: var(--white);
    border-radius: 12px;
    padding: 48px 40px;
    max-width: 480px;
    text-align: center;
    box-shadow: var(--shadow-md);
}
.expired-box .icon { font-size: 48px; margin-bottom: 16px; }
.expired-box h1 { font-size: 22px; margin-bottom: 12px; color: var(--dark); }
.expired-box p { color: var(--text-light); font-size: 15px; margin-bottom: 24px; }

/* ===== ADMIN TABLE ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
    text-align: left;
    padding: 10px 16px;
    background: #f5f5f5;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
}
td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
tr:hover td { background: #fafafa; }
.badge-active   { background: var(--success-bg); color: var(--success); }
.badge-expired  { background: var(--error-bg); color: var(--error); }
.badge-inactive { background: #f0f0f0; color: #888; }
.badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* ===== STAT CARDS (ADMIN) ===== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--white);
    border-radius: 10px;
    padding: 20px 24px;
    box-shadow: var(--shadow);
}
.stat-card .stat-label { font-size: 12px; color: var(--text-light); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--dark); margin-top: 4px; }

/* ===== RESPONSIVE ===== */
.mobile-header {
    display: none;
    background: var(--dark);
    padding: 0 16px;
    height: 56px;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.mobile-header-logo { width: 38px; height: 38px; border-radius: 5px; object-fit: contain; }
.hamburger { background: none; border: none; cursor: pointer; padding: 6px; }
.hamburger span { display: block; width: 22px; height: 2px; background: white; margin: 5px 0; border-radius: 2px; }

@media (max-width: 768px) {
    /* Mobile Header: fix oben, volle Breite */
    .mobile-header {
        display: flex;
        position: fixed;
        top: 0; left: 0; right: 0;
        z-index: 101;
    }

    /* Sidebar: unter Mobile-Header, als Overlay */
    .sidebar {
        top: 56px;
        left: -280px;
        transition: left 0.25s ease;
        z-index: 9999;
    }
    .sidebar.open { left: 0; }

    /* Main Content: kein linker Rand, Platz für Header oben */
    .main-content {
        margin-left: 0;
        padding-top: 56px;
    }

    /* Page Header & Body */
    .page-header {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .page-header h1 { font-size: 20px; }
    .page-body { padding: 16px; }

    /* Course Grid */
    .course-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }

    /* Lektion: 2-Spalten → 1 Spalte */
    .lektion-layout {
        grid-template-columns: 1fr !important;
    }
    .lektion-sidebar {
        position: static !important;
    }

    /* Video: volle Breite schon via padding-bottom, nur margin anpassen */
    .video-wrap { border-radius: 8px; margin-bottom: 16px; }

    /* Nav Buttons in Lektion: größere Touch-Targets */
    .btn-sm { padding: 10px 16px; font-size: 14px; }

    /* Modul-Lektionsliste rechts: normale Höhe, kein sticky */
    .lektion-sidebar .card { max-height: none; }

    /* Breadcrumb */
    .page-header nav { flex-wrap: wrap; gap: 4px; }

    /* Admin Tabelle */
    .table-wrap { border-radius: var(--radius); }
    td, th { padding: 10px 12px; font-size: 13px; }
}

/* ===== CHECKMARK ANIMATION ===== */
@keyframes check-pop {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.25); opacity: 1; }
    100% { transform: scale(1);   opacity: 1; }
}
@keyframes btn-flash {
    0%   { background: var(--accent2); border-color: var(--accent2); }
    100% { background: var(--accent2-dk); border-color: var(--accent2-dk); }
}
.btn-completing {
    pointer-events: none;
    opacity: 0.7;
}
.btn-done-flash {
    background: var(--accent2) !important;
    border-color: var(--accent2) !important;
    animation: btn-flash 0.4s ease forwards;
}
.check-circle-anim {
    animation: check-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
