/**
 * TC Heimbuchenthal Vereinsapp
 * Mobile-First Responsive Design
 */

:root {
    /* TC Heimbuchenthal Farben */
    --primary: #6B7B5C;
    --primary-dark: #4A5A3D;
    --primary-light: #8B9B7C;
    --accent: #E8A54B;
    --accent-dark: #D4912F;

    /* Neutral */
    --white: #FFFFFF;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Status */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    /* Schatten */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Abstände */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Rundungen */
    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Schrift */
    --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
}

/* Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--gray-800);
    background-color: var(--gray-50);
    min-height: 100vh;
    padding-bottom: 80px;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* Container */
.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.container-wide {
    max-width: 1200px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: var(--spacing-lg) var(--spacing-md);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.header-logo {
    width: 40px;
    height: 48px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: var(--font-size-lg);
    object-fit: contain;
}

.header-user {
    font-size: var(--font-size-sm);
    opacity: 0.9;
}

/* Balance Card */
.balance-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
    box-shadow: var(--shadow);
    text-align: center;
}

.balance-label {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    margin-bottom: var(--spacing-xs);
}

.balance-amount {
    font-size: var(--font-size-xl);
    font-weight: 700;
}

.balance-positive {
    color: var(--success);
}

.balance-negative {
    color: var(--danger);
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--gray-200);
}

.card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--gray-800);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-size-base);
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    min-height: 44px;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--white);
}

.btn-accent {
    background: var(--accent);
    color: var(--white);
}

.btn-accent:hover {
    background: var(--accent-dark);
    color: var(--white);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
    color: var(--gray-800);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-sm);
    min-height: 36px;
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-lg);
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Drink Buttons */
.drink-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
}

.drink-btn {
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.drink-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--white);
}

.drink-btn:active {
    transform: scale(0.98);
    background: var(--primary);
}

.drink-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: var(--spacing-sm);
    background: var(--gray-100);
}

.drink-btn:has(.drink-image) {
    min-height: auto;
}

.drink-name {
    font-weight: 500;
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-xs);
}

.drink-price {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--primary);
}

.drink-btn:hover .drink-price {
    color: var(--white);
}

/* Category Tabs */
.category-tabs {
    display: flex;
    gap: var(--spacing-xs);
    overflow-x: auto;
    padding: var(--spacing-sm) 0;
    margin-bottom: var(--spacing-md);
    -webkit-overflow-scrolling: touch;
}

.category-tab {
    flex-shrink: 0;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--gray-100);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.category-tab:hover,
.category-tab.active {
    background: var(--primary);
    color: var(--white);
}

/* Forms */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--spacing-xs);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-base);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 44px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(107, 123, 92, 0.2);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Lists */
.list {
    list-style: none;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--gray-100);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-weight: 500;
}

.list-item-subtitle {
    font-size: var(--font-size-sm);
    color: var(--gray-500);
}

.list-item-value {
    font-weight: 600;
    text-align: right;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-around;
    padding: var(--spacing-sm) 0;
    padding-bottom: max(var(--spacing-sm), env(safe-area-inset-bottom));
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-md);
    color: var(--gray-500);
    text-decoration: none;
    font-size: var(--font-size-xs);
    transition: color 0.2s;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary);
    text-decoration: none;
}

.nav-icon {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-xs);
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-800);
    color: var(--white);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    z-index: 1000;
    animation: toast-in 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* Alerts */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius);
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-sm);
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-info {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.table th,
.table td {
    padding: var(--spacing-sm);
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    font-weight: 600;
    background: var(--gray-50);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Badge */
.badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
    border-radius: var(--radius-full);
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.badge-success {
    background: #D1FAE5;
    color: #065F46;
}

.badge-warning {
    background: #FEF3C7;
    color: #92400E;
}

.badge-danger {
    background: #FEE2E2;
    color: #991B1B;
}

.badge-accent {
    background: #FFEDD5;
    color: #9A6014;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: var(--spacing-lg);
    padding-top: 5vh;
    overflow-y: auto;
}

@media (min-height: 700px) {
    .login-page {
        justify-content: center;
        padding-top: var(--spacing-lg);
    }
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    overflow: visible;
    margin-bottom: var(--spacing-xl);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.login-logo-icon {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-md);
    color: var(--white);
    font-size: 2rem;
    font-weight: bold;
}

.login-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--gray-800);
}

.login-subtitle {
    font-size: var(--font-size-sm);
    color: var(--gray-500);
}

/* Admin Layout */
.admin-header {
    background: var(--gray-800);
}

.admin-nav {
    display: flex;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    overflow-x: auto;
    background: var(--gray-700);
}

.admin-nav a {
    flex-shrink: 0;
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--gray-300);
    border-radius: var(--radius);
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: var(--gray-600);
    color: var(--white);
    text-decoration: none;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--gray-500);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-sm {
    font-size: var(--font-size-sm);
}

.font-bold {
    font-weight: 700;
}

.mt-1 {
    margin-top: var(--spacing-sm);
}

.mt-2 {
    margin-top: var(--spacing-md);
}

.mt-3 {
    margin-top: var(--spacing-lg);
}

.mb-1 {
    margin-bottom: var(--spacing-sm);
}

.mb-2 {
    margin-bottom: var(--spacing-md);
}

.mb-3 {
    margin-bottom: var(--spacing-lg);
}

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-1 {
    gap: var(--spacing-sm);
}

.gap-2 {
    gap: var(--spacing-md);
}

/* Desktop Styles */
@media (min-width: 768px) {
    body {
        padding-bottom: 0;
    }

    .container {
        max-width: 800px;
    }

    .bottom-nav {
        position: relative;
        border-top: none;
        border-bottom: 1px solid var(--gray-200);
        box-shadow: none;
        justify-content: center;
        gap: var(--spacing-xl);
        padding: var(--spacing-md) 0;
    }

    .nav-item {
        flex-direction: row;
        gap: var(--spacing-sm);
        font-size: var(--font-size-sm);
    }

    .drink-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .header-content {
        max-width: 800px;
    }
}

/* Grouped History Styles */
.history-group {
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: var(--spacing-xs);
}

.history-group:last-child {
    border-bottom: none;
}

.history-group summary {
    list-style: none;
    cursor: pointer;
    padding: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gray-50);
    border-radius: var(--radius);
    transition: background 0.2s;
}

.history-group summary::-webkit-details-marker {
    display: none;
}

.history-group summary:hover {
    background: var(--gray-100);
}

.history-group[open] summary {
    background: var(--gray-100);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.history-summary-left {
    display: flex;
    flex-direction: column;
}

.history-summary-date {
    font-weight: 600;
    font-size: var(--font-size-base);
}

.history-summary-count {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
}

.history-summary-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.history-summary-total {
    font-weight: 700;
    color: var(--danger);
}

.history-group-details {
    padding-left: var(--spacing-md);
    background: var(--white);
    border-top: 1px solid var(--gray-100);
}

.history-group-details .list-item {
    border-bottom: 1px solid var(--gray-50);
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-sm) 0;
}

.history-group-details .list-item:last-child {
    border-bottom: none;
}

.history-chevron {
    transition: transform 0.2s;
}

.history-group[open] .history-chevron {
    transform: rotate(180deg);
}

@media (min-width: 1024px) {
    .container-wide {
        max-width: 1200px;
    }

    .drink-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}