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

:root {
    --primary:    #e63946;
    --primary-dk: #c1121f;
    --dark:       #1a1a2e;
    --dark2:      #16213e;
    --text:       #333333;
    --text-light: #666666;
    --border:     #e0e0e0;
    --bg:         #f7f7f7;
    --white:      #ffffff;
    --success:    #2d6a4f;
    --success-bg: #d8f3dc;
    --error-bg:   #ffe0e0;
    --error:      #c1121f;
    --info-bg:    #e8f4fd;
    --info:       #1565c0;
    --radius:     8px;
    --shadow:     0 2px 12px rgba(0,0,0,0.08);
    --shadow-md:  0 4px 24px rgba(0,0,0,0.12);
}

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(--primary); 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: 420px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
    color: var(--white);
}
.login-logo h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; }
.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-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(--primary);
}

/* ===== 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(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dk); text-decoration: none; color: var(--white); }
.btn-secondary { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-secondary:hover { background: var(--primary); 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(--primary); color: var(--primary); 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: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo span {
    font-size: 14px;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.2px;
    line-height: 1.3;
    display: block;
}
.sidebar-logo small {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
    display: block;
}

.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(--primary);
    text-decoration: none;
}
.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-header {
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark2) 100%);
    padding: 28px 24px;
    color: var(--white);
}
.course-card-header h3 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.course-card-header p  { font-size: 12px; opacity: 0.6; }
.course-card-body { padding: 20px 24px; }
.course-card-body .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(--primary), #ff6b6b);
    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(--primary); }

.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(--primary); 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(--success);
    border-color: var(--success);
    color: white;
}

/* ===== VIDEO PLAYER ===== */
.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: 14px 20px;
    align-items: center;
    justify-content: space-between;
}
.mobile-header span { color: var(--white); font-weight: 700; font-size: 15px; }
.hamburger { background: none; border: none; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 22px; height: 2px; background: white; margin: 5px 0; border-radius: 2px; }

@media (max-width: 768px) {
    .mobile-header { display: flex; }
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .page-header { padding: 18px 20px; }
    .page-header h1 { font-size: 18px; }
    .page-body { padding: 20px; }
    .course-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
