/* Modern, premium variables */
:root {
    --primary-color: #d1122a;
    --primary-dark: #a10c20;
    --bg-color: #f4f6f8;
    --text-color: #2c3e50;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --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);
    --radius: 8px;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Global Form Element Focus Styles */
input:focus,
select:focus,
textarea:focus,
button:focus-visible {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(209, 18, 42, 0.08) !important;
    outline: none !important;
}

input,
select,
textarea {
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Global Button Styles (based on Punkteliste Import CSV / btn-action) */
button,
.btn,
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.2rem;
    border: 1px solid #000;
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
}

button:hover:not(:disabled),
.btn:hover:not(:disabled),
.btn-action:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

button:disabled,
.btn:disabled,
.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary buttons (e.g. login, register, btn-sync, etc.) */
.btn-primary,
.btn-action--primary,
.btn-sync {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.btn-primary:hover:not(:disabled),
.btn-action--primary:hover:not(:disabled),
.btn-sync:hover:not(:disabled) {
    background: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    color: #fff !important;
}

.btn-action--danger {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}

.btn-action--danger:hover:not(:disabled) {
    background: #ef4444 !important;
    color: #fff !important;
}

/* Standard Table Action Icon Buttons */
.table-action-btn {
    background: transparent;
    border: 1px solid transparent;
    padding: 0.35rem 0.55rem;
    border-radius: var(--radius);
    cursor: pointer;
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    text-decoration: none;
}
.table-action-btn:hover:not(:disabled) {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: #fee2e2;
}
.table-action-btn--delete:hover:not(:disabled) {
    color: #dc2626;
    border-color: #dc2626;
    background: #fee2e2;
}
.table-action-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}



.header {
    background-color: var(--card-bg);
    box-shadow: var(--shadow-sm);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left,
.header-right {
    flex: 1;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
}

.header-logo {
    max-height: 40px;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.header-right {
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
}

.lang-select {
    padding: 0.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    font-family: inherit;
    background-color: var(--card-bg);
    cursor: pointer;
    transition: border-color 0.2s;
}

.lang-select:hover {
    border-color: var(--primary-color);
}

/* Dashboard / Content */
.content {
    flex: 1;
    padding: 2rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Full-width override (no max-width cap) */
.content--fullwidth {
    max-width: none !important;
    padding-left: 2rem !important;
    padding-right: 2rem !important;
}

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

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    border-top: 4px solid var(--primary-color);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.card p {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Footer */
.footer {
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    text-align: center;
    color: #64748b;
}

.footer a {
    color: #64748b;
    text-decoration: none;
    margin: 0 1rem;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-wrap: nowrap;
        padding: 0.5rem 1rem;
    }

    .header-left {
        flex: 0 0 auto;
        text-align: left;
    }

    .header-logo {
        max-height: 30px;
    }

    .header-brand {
        gap: 0.5rem;
    }

    .header-title {
        font-size: 1.1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    .header-right {
        flex: 0 0 auto;
        text-align: right;
        margin-top: 0;
    }

    .lang-select {
        padding: 0.25rem 0.5rem;
        font-size: 0.85rem;
    }

    .table-pagination {
        width: 100%;
        flex: 1 0 100%;
        display: flex;
        justify-content: center;
        text-align: center;
    }

    .content {
        padding: 1.25rem 0.5rem;
    }

    .content--fullwidth {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .dashboard-grid {
        padding: 0 0.75rem;
    }
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 800px;
    background-color: var(--card-bg);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    z-index: 9999;
    border: 1px solid var(--border-color);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cookie-banner.show {
    opacity: 1;
    pointer-events: auto;
}

.cookie-text {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-color);
    line-height: 1.5;
}

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

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

@media (max-width: 640px) {
    .cookie-banner {
        flex-direction: column;
        text-align: center;
        padding: 1rem;
        bottom: 10px;
        width: calc(100% - 20px);
    }

    .cookie-banner .btn {
        width: 100%;
    }
}

/* Table Styles */
.table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-color);
}

.data-table th.fixed,
.data-table td.fixed {
    position: sticky;
    left: 0;
    background-color: inherit;
    z-index: 1;
    border-right: 2px solid var(--border-color);
}

.data-table th.fixed {
    background-color: #f8fafc;
    z-index: 2;
}

.data-table tbody tr {
    background-color: var(--card-bg);
}

.data-table tbody tr:hover td {
    background-color: #f1f5f9;
}

/* Table Controls */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.table-info {
    flex: 1;
    color: #64748b;
    font-size: 0.95rem;
}

.table-limit {
    flex: 1;
    text-align: center;
}

.table-pagination {
    flex: 1;
    text-align: right;
    display: flex;
    gap: 0.25rem;
    justify-content: flex-end;
}

.btn-page {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-color);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
}

.btn-page:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: default;
    background: #f8fafc;
}

/* ---- App Navigation (Horizontal Tabs / Default Menu Style) ---- */
.app-tabs,
.iv-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--border-color);
    width: 100%;
}

.app-tab,
.iv-tab {
    flex: none;
    padding: 0.8rem 1.4rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.app-tab:hover,
.iv-tab:hover {
    color: var(--primary-color);
    background: #fff5f6;
}

.app-tab--active,
.iv-tab--active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: #fff5f6;
}

/* App View Sections */
.app-view {
    display: none;
    animation: appFadeIn 0.25s ease-out;
}

.app-view--active {
    display: block;
}

/* App Card & Titles */
.app-card,
.iv-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem 2rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.app-section-title,
.iv-section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 0.5rem;
}

.app-view-header,
.iv-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.app-badge,
.iv-badge {
    background: var(--primary-color);
    color: #fff;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* ===========================
   Responsive / Mobile
   =========================== */
@media (max-width: 640px) {
    .header {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    .header-left {
        flex: 1 1 100%;
    }

    .header-right {
        flex: 1 1 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 0.5rem;
        flex-wrap: wrap;
        margin-top: 0.5rem;
    }

    .user-name {
        margin-right: auto;
        text-align: left;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-title {
        font-size: 1.1rem;
    }

    .content {
        padding: 1.5rem 1rem;
    }
}