/**
 * Kammer APP - Unified Stylesheet
 * Based on AHK Design System
 */

/* ============================================
   CSS VARIABLES - Design System Tokens
   ============================================ */

:root {
    /* Primary Colors */
    --color-primary: #003882;
    --color-primary-light: #CCD7E6;
    
    /* Primary Opacities */
    --color-primary-50: #E5EBF2;
    --color-primary-100: #CCD7E6;
    --color-primary-200: #B2C3D9;
    --color-primary-300: #99AFCD;
    --color-primary-400: #809BC1;
    --color-primary-500: #6688B4;
    --color-primary-600: #4D74A7;
    --color-primary-700: #33609B;
    --color-primary-800: #1A4C8F;
    --color-primary-900: #003882;
    
    /* Neutral Gray Scale */
    --color-gray-00: #FFFFFF;
    --color-gray-50: #FAFAFA;
    --color-gray-100: #F5F5F5;
    --color-gray-200: #E9EAEB;
    --color-gray-300: #D5D7DA;
    --color-gray-400: #A4A7AE;
    --color-gray-500: #717680;
    --color-gray-600: #535862;
    --color-gray-700: #414651;
    --color-gray-800: #252B37;
    --color-gray-900: #101828;
    
    /* Secondary Colors */
    --color-cyan: #008BAE;
    --color-pink: #C20F4E;
    --color-red: #CC0B10;
    --color-orange: #F28F00;
    --color-purple: #6C0077;
    --color-maroon: #850000;
    
    /* Background Colors */
    --bg-primary: #F9FAFB;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F6F8FC;
    --bg-quaternary: #F1F4F9;
    
    /* Text Colors */
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --text-inverse: #FFFFFF;
    
    /* Border Colors */
    --border-light: #E5E7EB;
    --border-medium: #CBD4E1;
    --border-dark: #9CA3AF;
    --border-primary: var(--color-primary);
    
    /* Semantic Colors */
    --color-success: #10B981;
    --color-warning: #F59E0B;
    --color-error: #EF4444;
    --color-info: var(--color-primary);
    
    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.25rem;
    --radius-full: 9999px;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    
    /* Typography - Source Sans Pro */
    --font-family: -apple-system, BlinkMacSystemFont, 'Source Sans Pro', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    
    /* Font Sizes */
    --font-size-xs: 0.75rem;      /* 12px */
    --font-size-sm: 0.875rem;     /* 14px */
    --font-size-base: 1rem;       /* 16px */
    --font-size-lg: 1.125rem;     /* 18px */
    --font-size-xl: 1.25rem;      /* 20px */
    --font-size-2xl: 1.5rem;      /* 24px */
    --font-size-3xl: 2rem;        /* 32px */
    --font-size-4xl: 2.625rem;    /* 42px */
    --font-size-5xl: 4rem;        /* 64px */
    
    /* Font Weights */
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Line Heights */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-Index Scale */
    --z-base: 1;
    --z-dropdown: 1000;
    --z-sticky: 1100;
    --z-fixed: 1200;
    --z-modal-backdrop: 1300;
    --z-modal: 1400;
    --z-popover: 1500;
    --z-tooltip: 1600;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-normal);
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
    min-height: 100svh;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

/* Titles */
.title-64 {
    font-size: 4rem;
    line-height: 53px;
    font-weight: var(--font-weight-bold);
}

.title-42 {
    font-size: 2.625rem;
    line-height: 58px;
    font-weight: var(--font-weight-bold);
}

.title-32 {
    font-size: 2rem;
    line-height: 40px;
    font-weight: var(--font-weight-bold);
}

.title-24-bold {
    font-size: 1.5rem;
    line-height: 36px;
    font-weight: var(--font-weight-bold);
}

.title-24-medium {
    font-size: 1.5rem;
    line-height: 36px;
    font-weight: var(--font-weight-medium);
}

/* Subtitles */
.subtitle-20-bold {
    font-size: 1.25rem;
    line-height: 24px;
    font-weight: var(--font-weight-bold);
}

.subtitle-20-medium {
    font-size: 1.25rem;
    line-height: 24px;
    font-weight: var(--font-weight-medium);
}

.subtitle-18-bold {
    font-size: 1.125rem;
    line-height: 22px;
    font-weight: var(--font-weight-bold);
}

.subtitle-18-semibold {
    font-size: 1.125rem;
    line-height: 22px;
    font-weight: var(--font-weight-semibold);
}

.subtitle-18-medium {
    font-size: 1.125rem;
    line-height: 22px;
    font-weight: var(--font-weight-medium);
}

.subtitle-18-regular {
    font-size: 1.125rem;
    line-height: 22px;
    font-weight: var(--font-weight-regular);
}

.subtitle-16-semibold {
    font-size: 1rem;
    line-height: 20px;
    font-weight: var(--font-weight-semibold);
}

/* Body Text */
.body-16-medium {
    font-size: 1rem;
    line-height: 24px;
    font-weight: var(--font-weight-medium);
}

.body-16-regular {
    font-size: 1rem;
    line-height: 24px;
    font-weight: var(--font-weight-regular);
}

.body-14-medium {
    font-size: 0.875rem;
    line-height: 22px;
    font-weight: var(--font-weight-medium);
}

.body-14-regular {
    font-size: 0.875rem;
    line-height: 22px;
    font-weight: var(--font-weight-regular);
}

/* Captions */
.caption-12-medium {
    font-size: 0.75rem;
    line-height: 20px;
    font-weight: var(--font-weight-medium);
}

.caption-12-regular {
    font-size: 0.75rem;
    line-height: 20px;
    font-weight: var(--font-weight-regular);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--text-primary);
}

h1 {
    font-size: var(--font-size-3xl);
}

h2 {
    font-size: var(--font-size-2xl);
}

h3 {
    font-size: var(--font-size-xl);
}

h4 {
    font-size: var(--font-size-lg);
}

h5 {
    font-size: var(--font-size-base);
}

h6 {
    font-size: var(--font-size-sm);
}

p {
    margin: 0;
    line-height: var(--line-height-normal);
}

/* Links */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-gray-00);
}

/* ============================================
   LOADING ANIMATION (Blue)
   ============================================ */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.loading svg {
    height: 48px;
    width: 64px;
}

.loading svg polyline {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.loading svg polyline#back {
    stroke: var(--color-primary-200);
    opacity: 0.3;
}

.loading svg polyline#front {
    fill: none;
    stroke: var(--color-primary);
    stroke-dasharray: 48, 144;
    stroke-dashoffset: 192;
    animation: dash-animation 1.4s linear infinite;
}

@keyframes dash-animation {
    72.5% {
        opacity: 0;
    }
    to {
        stroke-dashoffset: 0;
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    line-height: 1;
    text-align: center;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
}

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

/* Primary Button */
.btn-primary {
    background: var(--color-primary);
    color: var(--text-inverse);
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
    background: var(--bg-secondary);
    color: var(--color-primary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--color-primary);
}

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

.btn-outline:hover:not(:disabled) {
    background: var(--color-primary);
    color: var(--text-inverse);
}

/* Danger Button */
.btn-danger {
    background: var(--color-error);
    color: var(--text-inverse);
}

.btn-danger:hover:not(:disabled) {
    background: #DC2626;
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-xs);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: var(--font-size-base);
}

/* Button with Icon */
.btn-icon {
    padding: 0.75rem;
}

.btn i {
    transition: transform var(--transition-base);
}

.btn:hover i {
    transform: translateX(3px);
}

.ghost-btn {
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-primary);
    padding: 0.85rem 1.25rem;
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.manual-entry-button {
    margin-top: 1rem;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: var(--spacing-md);
}

label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

/* iOS Safari auto-zooms into focused fields smaller than 16px. */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="url"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        font-size: 16px;
    }
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 56, 130, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--bg-tertiary);
    cursor: not-allowed;
    opacity: 0.6;
}

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

/* Input with Icon */
.input-with-icon {
    position: relative;
}

.input-with-icon input {
    padding-left: 2.5rem;
}

.input-with-icon i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    margin-bottom: var(--spacing-lg);
}

.card-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.card-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.card-content {
    color: var(--text-primary);
}

.card-footer {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

/* ============================================
   ALERTS & NOTIFICATIONS
   ============================================ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-md);
}

.alert-info {
    background: #EFF6FF;
    border: 1px solid #DBEAFE;
    color: var(--color-info);
}

.alert-success {
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    color: var(--color-success);
}

.alert-warning {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    color: var(--color-warning);
}

.alert-error {
    background: #FEF2F2;
    border: 1px solid rgba(248, 113, 113, 0.4);
    color: var(--color-error);
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    border-radius: var(--radius-md);
    line-height: 1;
}

.badge-primary {
    background: #EFF6FF;
    border: 1px solid #DBEAFE;
    color: var(--color-primary);
}

.badge-success {
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    color: var(--color-success);
}

.badge-warning {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    color: var(--color-warning);
}

.badge-error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: var(--color-error);
}

.badge-gray {
    background: var(--color-gray-100);
    border: 1px solid var(--color-gray-300);
    color: var(--color-gray-700);
}

/* ============================================
   NAVIGATION - BOTTOM NAV (Desktop)
   ============================================ */

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    padding: var(--spacing-sm) var(--spacing-md);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-fixed);
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: var(--spacing-sm);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    text-decoration: none;
    min-width: 80px;
}

.bottom-nav .nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--color-primary);
}

.bottom-nav .nav-item.active {
    color: var(--color-primary);
    background: rgba(0, 56, 130, 0.05);
}

.bottom-nav .nav-icon {
    font-size: 1.25rem;
    transition: transform var(--transition-base);
}

.bottom-nav .nav-item:hover .nav-icon {
    transform: scale(1.1);
}

.bottom-nav .nav-label {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
}

@media (min-width: 769px) {
    .bottom-nav {
        display: flex;
        justify-content: center;
        gap: var(--spacing-md);
    }
    
    body {
        padding-bottom: 70px;
    }
}

/* ============================================
   NAVIGATION - MOBILE BUTTON
   ============================================ */

:root {
    /* Distance between the floating menu button and the bottom screen edge.
       Kept clear of the iPhone home indicator, Safari's collapsed toolbar and
       Android gesture bar, which otherwise intercept taps at the very bottom. */
    --nav-button-offset: max(1.5rem, calc(env(safe-area-inset-bottom, 0px) + 0.75rem));
}

.nav-button-container {
    display: flex;
    position: fixed;
    bottom: var(--nav-button-offset);
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: var(--z-popover);
}

.nav-button {
    position: relative;
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    pointer-events: auto;
    /* Reliable taps on touch devices: no double-tap-zoom delay, no grey flash,
       no accidental text selection / callout on long press. */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Invisible 8px ring that enlarges the touch target without changing the look. */
.nav-button::before {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: inherit;
}

.nav-button-icon,
.nav-button-icon span {
    pointer-events: none;
}

/* Hover effects only for real pointers; on touch screens :hover "sticks" after a tap. */
@media (hover: hover) and (pointer: fine) {
    .nav-button:hover {
        transform: scale(1.05);
        box-shadow: var(--shadow-xl);
    }
}

.nav-button:active {
    transform: scale(0.95);
}

.nav-button:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

.nav-button-icon {
    position: relative;
    width: 28px;
    height: 28px;
}

.nav-button-icon span {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 22px;
    height: 3px;
    background: var(--text-inverse);
    border-radius: 2px;
    transition: all var(--transition-base);
    transform: translate(-50%, -10px);
}

.nav-button.active .nav-button-icon span:nth-child(1) {
    transform: translate(-50%, -50%) rotate(45deg);
}

.nav-button.active .nav-button-icon span:nth-child(2) {
    opacity: 0;
}

.nav-button.active .nav-button-icon span:nth-child(3) {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.nav-button-icon span:nth-child(2) {
    transform: translate(-50%, 0);
}

.nav-button-icon span:nth-child(3) {
    transform: translate(-50%, 10px);
}

@media (min-width: 769px) {
    .nav-button-container {
        display: none;
    }
}

/* ============================================
   NAVIGATION - MOBILE MODAL
   ============================================ */

.nav-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.nav-modal.active {
    opacity: 1;
    visibility: visible;
}

.nav-modal-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    padding: var(--spacing-xl);
    padding-bottom: calc(var(--spacing-md) + 56px + var(--nav-button-offset)); /* space for close button */
    /* Short phones (e.g. iPhone SE): let the sheet scroll instead of cutting off the top. */
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateY(100%);
    transition: transform var(--transition-slow);
}

.nav-modal.active .nav-modal-content {
    transform: translateY(0);
}

.nav-modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
    text-align: center;
    width: 100%;
}

.nav-modal-logo {
    height: 40px;
    width: auto;
    display: block;
    margin: 0 auto;
}

.nav-modal-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.nav-modal-menu {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.nav-modal-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-base);
}

.nav-modal-item:hover {
    background: var(--color-primary-50);
    color: var(--color-primary);
}

.nav-modal-item.active {
    background: var(--color-primary);
    color: var(--text-inverse);
}

.nav-modal-icon {
    font-size: 1.25rem;
}

.nav-modal-footer {
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
    text-align: center;
}

/* ============================================
   LANGUAGE SWITCHER
   ============================================ */

.language-switcher {
    display: none;
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: var(--z-sticky);
    gap: var(--spacing-xs);
    padding: 0.25rem;
    background: var(--color-gray-100);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.language-button {
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
}

.language-button.active {
    background: var(--bg-secondary);
    color: var(--color-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.language-button:hover:not(.active) {
    color: var(--text-primary);
}

.lang-link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    text-decoration: none;
}

.lang-link:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-primary-50);
}

@media (min-width: 769px) {
    .language-switcher {
        display: inline-flex;
    }
}

/* ============================================
   EVENTS GRID
   ============================================ */

.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-xl);
    margin-top: var(--spacing-xl);
}

.event-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
    cursor: pointer;
}

.event-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}

.event-image {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.event-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.event-card:hover .event-image img {
    transform: scale(1.05);
}

.event-date {
    position: absolute;
    top: var(--spacing-md);
    left: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.event-date .day {
    display: block;
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    line-height: 1;
}

.event-date .month {
    display: block;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
}

.event-status-badge {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: var(--color-primary);
    color: var(--text-inverse);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
}

.event-content {
    padding: var(--spacing-lg);
}

.event-time {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.event-content h3 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    line-height: 1.4;
}

.event-content p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--spacing-md);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.event-details {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-light);
}

.event-location {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.event-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.event-view,
.event-register {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    text-align: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    text-decoration: none;
}

.event-view {
    background: var(--bg-tertiary);
    color: var(--color-primary);
    border: 1px solid var(--border-light);
}

.event-view:hover {
    background: var(--color-primary-50);
    border-color: var(--color-primary);
}

.event-register {
    background: var(--color-primary);
    color: var(--text-inverse);
}

.event-register:hover {
    background: var(--color-primary-700);
    transform: translateY(-1px);
}

/* Empty State */
.event-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    text-align: center;
}

.event-empty-state i {
    font-size: 3rem;
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-md);
}

.event-empty-state p {
    color: var(--text-secondary);
}

/* ============================================
   FILTER BUTTONS
   ============================================ */

.filters {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-lg);
}

.filter-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
}

.filter-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.filter-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--text-inverse);
}

/* ============================================
   SEARCH INPUT
   ============================================ */

.search-container {
    position: relative;
    margin-bottom: var(--spacing-lg);
}

.search-container input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
}

.search-container i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

/* ============================================
   HEADER
   ============================================ */

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    padding: var(--spacing-md) var(--spacing-lg);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    box-shadow: var(--shadow-xs);
}

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

.logo {
    height: 40px;
    width: auto;
}

.brand {
    display: flex;
    justify-content: center;
    margin-bottom: var(--spacing-lg);
}

.brand img {
    height: 50px;
    width: auto;
}

/* ============================================
   CONTAINER & LAYOUT
   ============================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Display */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

/* Flex */
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-end { justify-content: flex-end !important; }
.align-center { align-items: center !important; }
.align-start { align-items: flex-start !important; }
.align-end { align-items: flex-end !important; }
.gap-xs { gap: var(--spacing-xs) !important; }
.gap-sm { gap: var(--spacing-sm) !important; }
.gap-md { gap: var(--spacing-md) !important; }
.gap-lg { gap: var(--spacing-lg) !important; }

/* Text Alignment */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* Text Colors */
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary { color: var(--text-tertiary) !important; }
.text-inverse { color: var(--text-inverse) !important; }
.text-blue { color: var(--color-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-error { color: var(--color-error) !important; }

/* Font Weights */
.font-regular { font-weight: var(--font-weight-regular) !important; }
.font-medium { font-weight: var(--font-weight-medium) !important; }
.font-semibold { font-weight: var(--font-weight-semibold) !important; }
.font-bold { font-weight: var(--font-weight-bold) !important; }

/* Spacing - Margin */
.m-0 { margin: 0 !important; }
.mt-xs { margin-top: var(--spacing-xs) !important; }
.mt-sm { margin-top: var(--spacing-sm) !important; }
.mt-md { margin-top: var(--spacing-md) !important; }
.mt-lg { margin-top: var(--spacing-lg) !important; }
.mt-xl { margin-top: var(--spacing-xl) !important; }
.mb-xs { margin-bottom: var(--spacing-xs) !important; }
.mb-sm { margin-bottom: var(--spacing-sm) !important; }
.mb-md { margin-bottom: var(--spacing-md) !important; }
.mb-lg { margin-bottom: var(--spacing-lg) !important; }
.mb-xl { margin-bottom: var(--spacing-xl) !important; }

/* Spacing - Padding */
.p-0 { padding: 0 !important; }
.p-sm { padding: var(--spacing-sm) !important; }
.p-md { padding: var(--spacing-md) !important; }
.p-lg { padding: var(--spacing-lg) !important; }
.p-xl { padding: var(--spacing-xl) !important; }

/* Border Radius */
.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

/* Shadows */
.shadow-none { box-shadow: none !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-xl { box-shadow: var(--shadow-xl) !important; }

/* Width */
.w-full { width: 100% !important; }
.w-auto { width: auto !important; }

/* ============================================
   ANIMATIONS
   ============================================ */

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

.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

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

.animate-slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ============================================
   CODE INPUT (Verify Page)
   ============================================ */

.code-input-container {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    margin: var(--spacing-lg) 0;
}

.code-input {
    width: 50px;
    height: 60px;
    text-align: center;
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    transition: all var(--transition-base);
}

.code-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 56, 130, 0.1);
}

/* ============================================
   SUBTITLE & HINT
   ============================================ */

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    margin-bottom: var(--spacing-lg);
}

.hint {
    margin-top: var(--spacing-lg);
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    font-size: var(--font-size-xs);
    color: var(--text-primary);
    line-height: 1.4;
}

.email-badge {
    background: var(--color-gray-100);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
}

/* ============================================
   FOOTER LINKS
   ============================================ */

.footer-link,
.back-link {
    text-align: center;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-light);
}

.footer-link a,
.back-link a {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    text-decoration: none;
}

.footer-link a:hover,
.back-link a:hover {
    color: var(--text-primary);
}

/* ============================================
   RESEND LINK
   ============================================ */

.resend-link {
    text-align: center;
    margin-top: var(--spacing-md);
    font-size: var(--font-size-xs);
}

.resend-link a {
    color: var(--color-primary);
    text-decoration: none;
}

.resend-link a:hover {
    text-decoration: underline;
}

/* ============================================
   ICON CLASSES (placeholder for Font Awesome)
   ============================================ */

/* ============================================
   ICON CLASSES (SVG icons)
   ============================================ */

.icon-home::before,
.icon-events::before,
.icon-members::before,
.icon-mediathek::before,
.icon-profile::before,
.icon-crisis::before {
    content: "";
    display: inline-block;
    width: 1.25em;
    height: 1.25em;

    /* icon color = text color */
    background-color: currentColor;

    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
}

/* Home */
.icon-home::before {
    mask-image: url("/static/img/icons/home.svg");
    -webkit-mask-image: url("/static/img/icons/home.svg");
}

/* Events */
.icon-events::before {
    mask-image: url("/static/img/icons/event.svg");
    -webkit-mask-image: url("/static/img/icons/event.svg");
}

/* Members */
.icon-members::before {
    mask-image: url("/static/img/icons/members.svg");
    -webkit-mask-image: url("/static/img/icons/members.svg");
}

/* Mediathek / Media */
.icon-mediathek::before {
    mask-image: url("/static/img/icons/media.svg");
    -webkit-mask-image: url("/static/img/icons/media.svg");
}

/* Profile */
.icon-profile::before {
    mask-image: url("/static/img/icons/profile.svg");
    -webkit-mask-image: url("/static/img/icons/profile.svg");
}

/* Crisis */
.icon-crisis::before {
    mask-image: url("/static/img/icons/crisis.svg");
    -webkit-mask-image: url("/static/img/icons/crisis.svg");
}


/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    :root {
        --spacing-xl: 1.5rem;
        --spacing-2xl: 2rem;
    }
    
    body {
        padding-bottom: 0;
    }
    
    h1 {
        font-size: var(--font-size-2xl);
    }
    
    h2 {
        font-size: var(--font-size-xl);
    }
    
    .container,
    .main-content {
        padding: var(--spacing-md);
    }
    
    .card {
        padding: var(--spacing-lg);
    }
    
    .events-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }
    
    .logo {
        height: 32px;
    }
    
    .brand img {
        height: 40px;
    }
    
    .filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .filters::-webkit-scrollbar {
        display: none;
    }
    
    .code-input {
        width: 45px;
        height: 55px;
        font-size: var(--font-size-xl);
    }
}

@media (max-width: 480px) {
    .event-actions {
        flex-direction: column;
    }
    
    .event-view,
    .event-register {
        width: 100%;
    }
    
    .header {
        padding: 0.75rem 1rem;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .bottom-nav,
    .nav-button-container,
    .nav-modal,
    .language-switcher {
        display: none !important;
    }
    
    body {
        padding-bottom: 0;
    }
}

/* Keep image failures inside the existing frame with a same-origin SVG. */
img.image-fallback {
    object-fit: contain !important;
    background-color: #eef4fa;
}
