/* ============================================
   Fahrschul-Terminmanager - Modernes Design
   ============================================ */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #10b981;
    --secondary-dark: #059669;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --success-color: #22c55e;

    --bg-color: #f8fafc;
    --bg-card: #ffffff;
    --bg-dark: #1e293b;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;

    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-sm: 8px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #2563eb 0%, #0d9488 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* ============================================
   Header & Navigation
   ============================================ */

.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-text span {
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    padding: 0.5rem 1.25rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.nav-links a.active {
    color: var(--text-white);
    background: var(--primary-color);
}

/* ============================================
   Main Container
   ============================================ */

.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Cards
   ============================================ */

.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--text-white);
    padding: 2rem;
    text-align: center;
}

.card-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.card-header p {
    opacity: 0.9;
    font-size: 0.95rem;
}

.card-body {
    padding: 2rem;
}

/* ============================================
   Tabs
   ============================================ */

.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    position: relative;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Role Selection
   ============================================ */

.role-selection {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.role-card {
    padding: 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.role-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.role-card.selected {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.role-card input[type="radio"] {
    display: none;
}

.role-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.role-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.role-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ============================================
   Forms
   ============================================ */

.form-section {
    margin-bottom: 2rem;
}

.form-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-grid.single {
    grid-template-columns: 1fr;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-group label .required {
    color: var(--danger-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    background: var(--bg-card);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control::placeholder {
    color: var(--text-light);
}

.form-control.error {
    border-color: var(--danger-color);
}

select.form-control {
    cursor: pointer;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--text-white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-success {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark));
    color: var(--text-white);
}

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

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* ============================================
   Alerts
   ============================================ */

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: #166534;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-info {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-dark);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

/* ============================================
   Fahrlehrer Checkbox List
   ============================================ */

.fahrlehrer-list {
    max-height: 200px;
    overflow-y: auto;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.5rem;
}

.fahrlehrer-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.fahrlehrer-item:hover {
    background: var(--bg-color);
}

.fahrlehrer-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.75rem;
    accent-color: var(--primary-color);
}

.fahrlehrer-item label {
    cursor: pointer;
    margin: 0;
}

/* ============================================
   Dashboard
   ============================================ */

.dashboard-header {
    background: var(--bg-card);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.dashboard-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.dashboard-header .user-info {
    color: var(--text-secondary);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.dashboard-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.dashboard-card-icon.blue {
    background: rgba(37, 99, 235, 0.1);
}

.dashboard-card-icon.green {
    background: rgba(16, 185, 129, 0.1);
}

.dashboard-card-icon.orange {
    background: rgba(245, 158, 11, 0.1);
}

.dashboard-card h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.dashboard-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ============================================
   Utility Classes
   ============================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.hidden {
    display: none !important;
}

/* ============================================
   Auth Container
   ============================================ */

.auth-container {
    width: 100%;
    max-width: 550px;
}

.auth-container.wide {
    max-width: 700px;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .nav-links a {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    /* Abmelden-Link als Icon */
    .nav-links a[href*="logout"] {
        font-size: 0;
    }

    .nav-links a[href*="logout"]::before {
        content: "🚪";
        font-size: 1.1rem;
    }

    .role-selection {
        grid-template-columns: 1fr;
    }

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

    .tabs {
        flex-direction: column;
    }

    .tab-btn {
        border-bottom: 1px solid var(--border-color);
    }

    .tab-btn.active::after {
        display: none;
    }

    .card-body {
        padding: 1.5rem;
    }
}

/* ============================================
   Step Navigation (for multi-step forms)
   ============================================ */

.step-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.step {
    display: flex;
    align-items: center;
}

.step-number {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: var(--transition);
}

.step.active .step-number,
.step.completed .step-number {
    background: var(--primary-color);
    color: var(--text-white);
}

.step-line {
    width: 60px;
    height: 2px;
    background: var(--border-color);
    margin: 0 0.5rem;
}

.step.completed + .step .step-line {
    background: var(--primary-color);
}

/* ============================================
   Loading Spinner
   ============================================ */

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* ============================================
   Google Calendar Sync Styles
   ============================================ */

/* Google Status Indicator */
.google-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

.google-status .status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.google-status.connected .status-indicator {
    background: var(--success-color);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.google-status.disconnected .status-indicator {
    background: var(--text-light);
}

.google-status.connected {
    color: var(--success-color);
    font-weight: 500;
}

/* Google Connect Button */
.google-connect-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.google-connect-btn svg {
    flex-shrink: 0;
}

/* Sync Button with Badge */
.sync-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.sync-btn .sync-badge {
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.sync-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* Import Item List */
.import-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin-bottom: 0.75rem;
    background: white;
    transition: var(--transition);
}

.import-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.import-item:last-child {
    margin-bottom: 0;
}

.import-info {
    flex: 1;
    min-width: 0;
}

.import-info strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.import-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.import-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
    flex-shrink: 0;
}

/* Small Button Variant */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.85rem;
}

/* Import Details in Modal */
.import-details p {
    margin: 0.25rem 0;
    color: var(--text-secondary);
}

.import-details p strong {
    color: var(--text-primary);
}

/* Sync Status Indicator on Termin Block */
.sync-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: bold;
}

.sync-indicator.synced {
    background: var(--success-color);
    color: white;
}

.sync-indicator.pending {
    background: var(--accent-color);
    color: white;
}

.sync-indicator.error {
    background: var(--danger-color);
    color: white;
}

.sync-indicator.imported {
    background: var(--primary-color);
    color: white;
}
