/* === Groh Learning - Stylesheet === */
:root {
    --primary: #00305b;
    --gray: #565656;
    --light-gray: #c6c6c6;
    --bg: #f5f5f5;
    --white: #ffffff;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
}

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

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

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

/* === Layout === */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--primary);
    color: var(--white);
    padding: 0;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar .logo {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar .logo img {
    max-width: 160px;
    height: auto;
}

.sidebar .logo h2 {
    color: var(--white);
    font-size: 1.2rem;
    margin-top: 8px;
}

.sidebar nav { padding: 15px 0; }

.sidebar nav a {
    display: block;
    color: rgba(255,255,255,0.8);
    padding: 12px 20px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
    text-decoration: none;
    border-left-color: var(--white);
}

.sidebar nav a .nav-icon {
    display: inline-block;
    width: 24px;
    text-align: center;
    margin-right: 10px;
}

.sidebar .sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.85rem;
}

.sidebar .sidebar-footer a {
    color: rgba(255,255,255,0.6);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    min-height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-gray);
}

.page-header h1 {
    color: var(--primary);
    font-size: 1.6rem;
}

/* === Cards === */
.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 25px;
    margin-bottom: 20px;
}

.card h3 {
    color: var(--primary);
    margin-bottom: 15px;
}

/* === Tabelle === */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

table th {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    white-space: nowrap;
}

table tr:hover { background: #f8f9fa; }

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; opacity: 0.9; }

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

.btn-success {
    background: var(--success);
    color: var(--white);
}

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

.btn-secondary {
    background: var(--light-gray);
    color: var(--gray);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

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

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

/* === Formulare === */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--gray);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

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

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

select.form-control { cursor: pointer; }

/* === Flash Messages === */
.flash {
    padding: 14px 18px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

.flash-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* === Login-Seite === */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #004a8a 100%);
}

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 420px;
}

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

.login-box .logo img {
    max-width: 180px;
    height: auto;
}

.login-box .logo h1 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-top: 10px;
}

.login-box .btn { width: 100%; }

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 5px;
}

/* === Badge === */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }

/* === Slide Viewer === */
.slide-viewer {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    max-width: 960px;
    margin: 0 auto;
}

.slide-viewer .slide-image {
    width: 100%;
    height: auto;
    display: block;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

.slide-viewer .slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
}

.slide-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    max-width: 960px;
    margin: 0 auto;
}

.slide-nav .slide-counter {
    color: var(--gray);
    font-weight: 600;
}

/* === Quiz === */
.quiz-card {
    background: var(--white);
    border-radius: 12px;
    padding: 30px;
    max-width: 700px;
    margin: 0 auto;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.quiz-card .question-text {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 25px;
    font-weight: 600;
}

.quiz-card .answer-option {
    display: block;
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 1rem;
}

.quiz-card .answer-option:hover {
    border-color: var(--primary);
    background: #f0f4f8;
}

.quiz-card .answer-option.selected {
    border-color: var(--primary);
    background: #e8eef4;
}

.quiz-card .answer-option.correct {
    border-color: var(--success);
    background: #d4edda;
}

.quiz-card .answer-option.wrong {
    border-color: var(--danger);
    background: #f8d7da;
}

.quiz-card .answer-option:disabled {
    cursor: default;
}

.quiz-result {
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    font-weight: 600;
    text-align: center;
}

.quiz-result.correct { background: #d4edda; color: #155724; }
.quiz-result.wrong { background: #f8d7da; color: #721c24; }

/* === Progressbar === */
.progress-bar-wrapper {
    background: #e9ecef;
    border-radius: 10px;
    height: 12px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
    transition: width 0.3s;
}

/* === Kurs-Karten === */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.course-card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.2s;
}

.course-card:hover { transform: translateY(-2px); }

.course-card .course-card-header {
    background: var(--primary);
    color: var(--white);
    padding: 20px;
}

.course-card .course-card-header h3 { color: var(--white); margin: 0; }

.course-card .course-card-body { padding: 20px; }

/* === Drag&Drop Sortierung === */
.sortable-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: var(--white);
    border: 1px solid #eee;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: grab;
    transition: box-shadow 0.2s;
}

.sortable-item:active { cursor: grabbing; }
.sortable-item.dragging {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    opacity: 0.8;
}

.sortable-item .drag-handle {
    color: var(--light-gray);
    font-size: 1.2rem;
}

.sortable-item .item-content { flex: 1; }

.sortable-item .item-actions {
    display: flex;
    gap: 6px;
}

/* === Invite Link === */
.invite-link-box {
    display: flex;
    gap: 10px;
    align-items: center;
}

.invite-link-box input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #f8f9fa;
}

/* === Modal === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--white);
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal h3 {
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--light-gray);
}

/* === Upload Zone === */
.upload-zone {
    border: 3px dashed var(--light-gray);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: #f0f4f8;
}

.upload-zone .upload-icon {
    font-size: 3rem;
    color: var(--light-gray);
    margin-bottom: 10px;
}

.upload-progress {
    margin-top: 15px;
}

.upload-progress .file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.upload-progress .file-item .file-name {
    flex: 1;
    font-size: 0.85rem;
}

/* === Responsive === */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        transition: left 0.3s;
        z-index: 200;
    }

    .sidebar.open { left: 0; }

    .main-content { margin-left: 0; }

    .mobile-toggle {
        display: block !important;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 150;
        background: var(--primary);
        color: var(--white);
        border: none;
        border-radius: 6px;
        padding: 10px 14px;
        cursor: pointer;
        font-size: 1.2rem;
    }

    .page-header { flex-direction: column; gap: 10px; }

    .stats-grid { grid-template-columns: 1fr 1fr; }
}

.mobile-toggle { display: none; }

/* === Utility === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-10 { gap: 10px; }
.hidden { display: none; }
