/* Social Energie - Hauptstylesheet */
/* Hell & Freundliches Design */

:root {
    /* Primärfarben */
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #3730A3;

    /* Hintergrund & Oberflächen */
    --bg: #F9FAFB;
    --bg-alt: #F3F4F6;
    --card: #FFFFFF;

    /* Text */
    --text: #1F2937;
    --text-light: #6B7280;
    --text-muted: #9CA3AF;

    /* Borders */
    --border: #E5E7EB;
    --border-light: #F3F4F6;

    /* Status-Farben */
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;

    /* Batterie-Farben (7 Stufen) */
    --battery-1: #EF4444;
    --battery-2: #F97316;
    --battery-3: #F59E0B;
    --battery-4: #EAB308;
    --battery-5: #84CC16;
    --battery-6: #22C55E;
    --battery-7: #10B981;

    /* Schatten */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Abstände */
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Basis */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.container-sm {
    max-width: 640px;
}

.container-md {
    max-width: 768px;
}

/* Navigation */
.navbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.navbar-brand svg {
    width: 32px;
    height: 32px;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    color: var(--text-light);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--primary);
    background: var(--bg-alt);
}

.nav-link.active {
    color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

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

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

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

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

.btn-danger:hover {
    background: #DC2626;
}

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

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-block {
    width: 100%;
}

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

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-alt);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

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

.form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

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

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.form-error {
    font-size: 0.8125rem;
    color: var(--error);
    margin-top: 0.25rem;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-checkbox input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #065F46;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

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

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #92400E;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: #1E40AF;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Batterie-Widget */
.battery-widget {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.battery-container {
    position: relative;
    width: 100%;
    height: 100px;
    background: var(--bg-alt);
    border-radius: var(--radius-lg);
    border: 3px solid var(--border);
    overflow: hidden;
}

.battery-cap {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 40px;
    background: var(--border);
    border-radius: 0 4px 4px 0;
}

.battery-fill {
    height: 100%;
    transition: width 0.5s ease, background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.battery-level {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.battery-segments {
    display: flex;
    gap: 4px;
    padding: 8px;
    height: 100%;
}

.battery-segment {
    flex: 1;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    opacity: 0.3;
}

.battery-segment.active {
    opacity: 1;
}

.battery-segment:hover {
    transform: scale(1.05);
}

.battery-segment[data-level="1"] { background: var(--battery-1); }
.battery-segment[data-level="2"] { background: var(--battery-2); }
.battery-segment[data-level="3"] { background: var(--battery-3); }
.battery-segment[data-level="4"] { background: var(--battery-4); }
.battery-segment[data-level="5"] { background: var(--battery-5); }
.battery-segment[data-level="6"] { background: var(--battery-6); }
.battery-segment[data-level="7"] { background: var(--battery-7); }

/* Batterie-Farben nach Level */
.battery-fill[data-level="1"] { background: var(--battery-1); width: 14.28%; }
.battery-fill[data-level="2"] { background: var(--battery-2); width: 28.56%; }
.battery-fill[data-level="3"] { background: var(--battery-3); width: 42.84%; }
.battery-fill[data-level="4"] { background: var(--battery-4); width: 57.12%; }
.battery-fill[data-level="5"] { background: var(--battery-5); width: 71.40%; }
.battery-fill[data-level="6"] { background: var(--battery-6); width: 85.68%; }
.battery-fill[data-level="7"] { background: var(--battery-7); width: 100%; }

/* Emotions-Grid */
.emotions-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}

.emotion-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.5rem;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
}

.emotion-btn:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
}

.emotion-btn.selected {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

.emotion-btn .emoji {
    font-size: 2rem;
    margin-bottom: 0.25rem;
}

.emotion-btn .label {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
    border: 1px solid var(--border-light);
}

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

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* Avatar */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.avatar-lg {
    width: 80px;
    height: 80px;
    font-size: 2rem;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Friends List */
.friend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.friend-item:last-child {
    border-bottom: none;
}

.friend-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.friend-details {
    display: flex;
    flex-direction: column;
}

.friend-name {
    font-weight: 600;
    color: var(--text);
}

.friend-status {
    font-size: 0.8125rem;
    color: var(--text-light);
}

.friend-battery {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.friend-battery-bar {
    width: 60px;
    height: 20px;
    background: var(--bg-alt);
    border-radius: 4px;
    overflow: hidden;
}

.friend-battery-fill {
    height: 100%;
    transition: width 0.3s;
}

/* History List */
.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.history-date {
    min-width: 80px;
    font-size: 0.8125rem;
    color: var(--text-light);
}

.history-battery {
    width: 60px;
    height: 24px;
    background: var(--bg-alt);
    border-radius: 4px;
    overflow: hidden;
}

.history-battery-fill {
    height: 100%;
}

.history-emotion {
    font-size: 1.5rem;
}

.history-note {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Page Header */
.page-header {
    padding: 2rem 0;
    text-align: center;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-light);
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header .logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-light);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* QR Code */
.qr-container {
    text-align: center;
    padding: 2rem;
}

.qr-code {
    background: white;
    padding: 1rem;
    border-radius: var(--radius);
    display: inline-block;
    margin-bottom: 1rem;
}

.share-link {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.share-link input {
    flex: 1;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.py-3 { padding-top: 1rem; padding-bottom: 1rem; }
.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-5 { padding-top: 2rem; padding-bottom: 2rem; }

.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.hidden { display: none; }

/* Responsive */
@media (max-width: 768px) {
    .navbar .container {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .navbar-nav {
        width: 100%;
        justify-content: center;
    }

    .nav-link span {
        display: none;
    }

    .emotions-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .emotions-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .btn-lg {
        padding: 0.75rem 1.25rem;
    }
}

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pulse {
    animation: pulse 2s infinite;
}

/* Loading Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Dark mode support (optional, via class) */
.dark-mode {
    --bg: #111827;
    --bg-alt: #1F2937;
    --card: #1F2937;
    --text: #F9FAFB;
    --text-light: #9CA3AF;
    --border: #374151;
    --border-light: #374151;
}

/* ===================================
   BARRIEREFREIHEIT / ACCESSIBILITY
   =================================== */

/* Skip-Link für Tastaturnavigation */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    z-index: 9999;
    text-decoration: none;
    font-weight: 600;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 1rem;
}

/* Fokus-Stile für alle interaktiven Elemente */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Verbesserte Fokus-Stile für Buttons */
.btn:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.3);
}

/* Fokus-Stile für Formularfelder */
.form-input:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-color: var(--primary);
}

/* Fokus für Nav-Links */
.nav-link:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    background: var(--bg-alt);
}

/* Fokus für Batterie-Segmente */
.battery-segment:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    transform: scale(1.05);
}

/* Fokus für Emotions-Buttons */
.emotion-btn:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-color: var(--primary);
}

/* Fokus für Checkboxen */
.form-checkbox input:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Screenreader-Only Klasse */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Fokus innerhalb von sr-only sichtbar machen */
.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Reduzierte Bewegung für Nutzer, die das bevorzugen */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .fade-in {
        animation: none;
    }

    .pulse {
        animation: none;
    }

    .spinner {
        animation: none;
    }
}

/* Hochkontrast-Modus Unterstützung */
@media (prefers-contrast: high) {
    :root {
        --border: #1F2937;
        --text-light: #374151;
    }

    .btn {
        border: 2px solid currentColor;
    }

    .card {
        border: 2px solid var(--border);
    }

    .form-input {
        border: 2px solid var(--border);
    }
}

/* Mindestgröße für Touch-Targets (44x44px nach WCAG) */
.btn,
.nav-link,
.emotion-btn,
.battery-segment {
    min-height: 44px;
    min-width: 44px;
}

/* Verbesserte Link-Unterstreichung */
a:not(.btn):not(.nav-link):not(.navbar-brand) {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:not(.btn):not(.nav-link):not(.navbar-brand):hover {
    text-decoration-thickness: 2px;
}

/* Sichtbare Labels für Formulare */
.form-label {
    display: block;
    margin-bottom: 0.5rem;
}

/* Fehleranzeige für Screenreader verbessern */
.alert[role="alert"] {
    border-left: 4px solid currentColor;
}

/* ===================================
   COOKIE BANNER
   =================================== */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 6px -1px rgb(0 0 0 / 0.1);
    padding: 1rem;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.cookie-banner.visible {
    transform: translateY(0);
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.cookie-banner-text {
    flex: 1;
    min-width: 300px;
}

.cookie-banner-text p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text);
}

.cookie-banner-text a {
    color: var(--primary);
}

.cookie-banner-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .cookie-banner-content {
        flex-direction: column;
        text-align: center;
    }

    .cookie-banner-actions {
        width: 100%;
        justify-content: center;
    }
}

/* ===================================
   FOOTER & LEGAL PAGES
   =================================== */
.site-footer {
    padding: 2rem 0;
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: auto;
    border-top: 1px solid var(--border-light);
    background: var(--bg-alt);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover,
.footer-links a:focus {
    color: var(--primary);
    text-decoration: underline;
}

/* Legal Page Styling */
.legal-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

.legal-content h2 {
    font-size: 1.25rem;
    color: var(--text);
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.legal-content h3 {
    font-size: 1rem;
    color: var(--text);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.legal-content p,
.legal-content ul,
.legal-content ol {
    margin-bottom: 1rem;
    color: var(--text-light);
}

.legal-content ul,
.legal-content ol {
    padding-left: 1.5rem;
}

.legal-content li {
    margin-bottom: 0.5rem;
}

.legal-content address {
    font-style: normal;
    background: var(--bg-alt);
    padding: 1rem;
    border-radius: var(--radius);
    margin: 1rem 0;
}
