/*
 * Zentrales Stylesheet für Cardmaster
 * (ausgelagert aus index.php, karten_anlegen.php, lektionen_anlegen.php)
 */

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

html {
    min-height: 100vh;
}

html, body {
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
}

body {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    align-items: center;
}

.container, .main-content, .form-container {
    background: white;
    border-radius: 0;
    box-shadow: none;
    padding: 30px;
    width: 100%;
    max-width: 90%;
    height: calc(100vh - 70px);
    overflow-y: auto;
    flex: 1;
}

h1, .headline {
    color: #333;
    margin-bottom: 15px;
    font-size: 2em;
}

h1.startmenu-title {
    font-size: 2.5em;
}

h2, .subheadline {
    color: #666;
    margin-bottom: 40px;
    font-size: 1.1em;
}

.subtitle {
    color: #666;
    margin-bottom: 40px;
    font-size: 1.1em;
}

.btn, .button, button, input[type="submit"] {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 24px;
    border-radius: 5px;
    font-size: 1em;
    font-weight: bold;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover, .button:hover, button:hover, input[type="submit"]:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}

.btn:active, .button:active, button:active, input[type="submit"]:active {
    transform: translateY(0);
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: bold;
}

input[type="text"], input[type="password"], textarea, select {
    width: 100%;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    font-family: Arial, sans-serif;
    transition: border-color 0.3s;
}

input[type="text"]:focus, input[type="password"]:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #667eea;
}

.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: bold;
}

.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: bold;
}

.info {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 15px;
    margin-bottom: 25px;
    border-radius: 4px;
    color: #1565c0;
    line-height: 1.5;
    margin: 5px 0;
}

.flex-col {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.back-link {
    display: block;
    color: #667eea;
    text-decoration: none;
    margin-bottom: 30px;
    font-size: 0.9em;
}

.back-link:hover {
    text-decoration: underline;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.form-col {
    flex: 1;
    margin-bottom: 0;
}

.form-col textarea {
    min-height: 150px;
    resize: vertical;
}

button[type="submit"], .btn[type="submit"] {
    width: 100%;
    display: block;
}

.message {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-weight: bold;
}

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

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

.info-box {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 15px;
    margin-bottom: 25px;
    border-radius: 4px;
    text-align: left;
}

.info-box p {
    color: #1565c0;
    line-height: 1.5;
    margin: 5px 0;
}

.help-text {
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

/* Navbar Styles */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3em;
    font-weight: bold;
}

.navbar-logo {
    font-size: 1.5em;
}

.navbar-title {
    color: white;
}

.navbar-menu {
    display: flex;
    gap: 5px;
    flex: 1;
    justify-content: center;
}

.navbar-link {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
}

.navbar-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.navbar-link.active {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    color: white;
}

.user-icon {
    font-size: 1em;
}

.user-role {
    color: rgba(255, 255, 255, 0.7);
    font-weight: normal;
    margin-left: 3px;
    font-size: 0.9em;
}

.logout-link {
    color: white;
    background: rgba(220, 53, 69, 0.8);
    text-decoration: none;
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.logout-link:hover {
    background: rgba(220, 53, 69, 1);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Hamburger Menu Toggle */
.navbar-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1001;
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.navbar-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.navbar-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.navbar-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 0 15px;
        height: 60px;
    }
    
    .navbar-toggle {
        display: flex;
    }
    
    .navbar-brand {
        font-size: 1.1em;
    }
    
    .navbar-logo {
        font-size: 1.3em;
    }
    
    .navbar-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        padding: 20px;
        gap: 10px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 0 8px 16px rgba(0,0,0,0.2);
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
    
    .navbar-menu.active {
        transform: translateX(0);
    }
    
    .navbar-link {
        width: 100%;
        text-align: left;
        padding: 15px 20px;
        font-size: 1.1em;
    }
    
    .navbar-user {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        flex-direction: column;
        background: rgba(0, 0, 0, 0.9);
        padding: 20px;
        gap: 15px;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        box-shadow: 0 -4px 16px rgba(0,0,0,0.3);
    }
    
    .navbar-user.active {
        transform: translateY(0);
    }
    
    .user-info {
        justify-content: center;
        font-size: 1em;
    }
    
    .logout-link {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
        font-size: 1em;
    }
    
    .container {
        height: calc(100vh - 60px);
        padding: 20px;
    }
}

/* Benutzerverwaltung Styles */
.user-form-section {
    margin-bottom: 35px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.user-form-section h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.3em;
    color: #495057;
}

.create-user-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.create-user-form .btn {
    grid-column: span 1;
}

.btn-password {
    padding: 6px 12px;
    background: #ffc107;
    color: #333;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85em;
    text-align: center;
    transition: background 0.3s;
}

.btn-password:hover {
    background: #ffca2c;
}

.btn-password-submit {
    padding: 8px 14px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    white-space: nowrap;
}

.btn-password-submit:hover {
    background: #218838;
}

.btn-cancel {
    padding: 8px 10px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
}

.btn-cancel:hover {
    background: #5a6268;
}

.password-change-form {
    margin-top: 10px;
}

/* Listen-Styles für Karten und Lektionen */
.cards-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cards-table-wrapper {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.cards-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.cards-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.cards-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: bold;
    font-size: 0.95em;
}

.cards-table tbody tr {
    border-bottom: 1px solid #dee2e6;
    transition: background 0.2s ease;
}

.cards-table tbody tr:hover {
    background: #f8f9fa;
}

.cards-table tbody tr:last-child {
    border-bottom: none;
}

.cards-table td {
    padding: 12px 15px;
    vertical-align: top;
}

.cards-table td:first-child,
.cards-table td:nth-child(2) {
    word-break: break-word;
}

.card-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.card-content {
    flex: 1;
    min-width: 0;
}

.card-content strong {
    color: #333;
}

.card-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn-edit, .btn-delete {
    padding: 6px 12px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

.btn-edit {
    background: #667eea;
    color: white;
}

.btn-edit:hover {
    background: #5568d3;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

.lesson-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    margin-top: 5px;
}

/* Import Module */
.import-section {
    max-width: 700px;
    margin: 0 auto;
}

.dropzone {
    border: 3px dashed #667eea;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dropzone:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    border-color: #5568d3;
    transform: translateY(-2px);
}

.dropzone.dragover {
    background: linear-gradient(135deg, #e7f0ff 0%, #d4e4ff 100%);
    border-color: #4a5dc9;
    border-width: 4px;
}

.dropzone-content {
    pointer-events: none;
}

.dropzone-icon {
    font-size: 3em;
    display: block;
    margin-bottom: 10px;
}

.info-box {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    border-left: 4px solid #ffc107;
    padding: 15px;
    border-radius: 8px;
    font-size: 0.95em;
}

.info-box p {
    margin: 5px 0;
}

.preview-table-wrapper {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
}

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

.preview-table thead {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    z-index: 10;
}

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

.preview-table tbody tr:hover {
    background: #f8f9fa;
}

.preview-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

.preview-table tbody tr:nth-child(even):hover {
    background: #f0f0f0;
}

/* Training Module */
.training-container {
    max-width: 800px;
    margin: 0 auto;
}

.training-header {
    text-align: center;
    margin-bottom: 30px;
}

.training-stats-wrapper {
    max-width: 800px;
    margin: 0 auto 30px auto;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.training-stats-text {
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.training-progress {
    margin-bottom: 15px;
}

.progress-text {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #667eea;
    font-size: 0.9em;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.flashcard {
    perspective: 1000px;
    margin: 40px auto;
    width: 100%;
    height: 500px;
    max-height: 80vh;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 40px;
    background: white;
    overflow-y: auto;
}

.flashcard-back {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transform: rotateY(180deg);
}

.card-lesson-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    z-index: 10;
}

.card-label {
    font-size: 1.1em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
    margin-top: 10px;
    width: 100%;
    text-align: center;
}

.card-text {
    font-size: 1.5em;
    text-align: center;
    line-height: 1.6;
    color: #333;
    margin-bottom: 20px;
    width: 100%;
    display: block;
}

.btn-flip {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-flip:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.btn-solved {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-solved:hover {
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.btn-next-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-next-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.training-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.btn-nav {
    background: #6c757d;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-nav:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.btn-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-nav-next {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.btn-nav-next:hover:not(:disabled) {
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
}

.training-complete {
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.training-complete h2 {
    color: #28a745;
    margin-bottom: 15px;
    font-size: 2.5em;
}

.lesson-selection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.lesson-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
    min-height: 180px;
}

.lesson-card:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
}

.lesson-name-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 5px;
}

.lesson-parent-line {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 8px;
    min-height: 2.5em;
}

.lesson-child-line {
    display: flex;
    align-items: center;
    padding: 8px 12px 8px 42px;
    background: linear-gradient(135deg, #667eea08 0%, #764ba208 100%);
    border-radius: 8px;
    min-height: 2.5em;
}

.lesson-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.lesson-parent-name {
    font-weight: bold;
    font-size: 1.1em;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.lesson-name {
    font-weight: 600;
    font-size: 1em;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.lesson-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 0;
}

.lesson-arrow {
    font-size: 1.5em;
    color: #667eea;
}

.lesson-stats {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.lesson-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.lesson-stat .stat-label {
    font-size: 0.8em;
    color: #666;
    font-weight: 500;
}

.lesson-stat .stat-value {
    font-size: 1.2em;
    font-weight: bold;
    color: #667eea;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-block;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
