:root {
    --color-primary: #2A9D8F;
    --color-primary-dark: #21807a;
    --color-accent: #F4A261;
    --color-bg: #F5F7F8;
    --color-card: #FFFFFF;
    --color-text: #1F2933;
    --color-muted: #6B7280;
    --color-border: #E5E9EC;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
    --max-width: 720px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    padding-bottom: 64px;
}

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

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    display: block;
}

/* Topbar */
.topbar {
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

.brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.02em;
}

.brand:hover {
    text-decoration: none;
}

.topnav {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 0.95rem;
}

.topnav a {
    color: var(--color-text);
}

.topnav a.active {
    color: var(--color-primary);
    font-weight: 600;
}

/* Layout */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 4px 0 16px;
}

/* Cards */
.card {
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-bottom: 16px;
}

.card-flat {
    border: 1px solid var(--color-border);
    box-shadow: none;
}

/* Forms */
label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
    margin-top: 12px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: var(--color-card);
    color: var(--color-text);
}

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

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

.btn {
    display: inline-block;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--color-primary);
    color: #fff;
    margin-top: 14px;
}

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

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

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

.btn-link-muted {
    background: none;
    border: none;
    color: var(--color-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 6px 4px;
    text-decoration: underline;
}

.btn-link-muted:hover {
    color: #B3261E;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    margin-top: 0;
}

.btn-danger {
    background: #E76F51;
}

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

/* Alerts */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.alert-error {
    background: #FDECEA;
    color: #B3261E;
    border: 1px solid #F5C6C2;
}

.alert-success {
    background: #E6F4EA;
    color: #1E7B34;
    border: 1px solid #BFE3CB;
}

/* Posts / Feed */
.post {
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    object-fit: cover;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
}

.avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 1.6rem;
}

.post-meta {
    font-size: 0.85rem;
    color: var(--color-muted);
}

.post-meta a {
    color: var(--color-text);
    font-weight: 600;
}

.post-body {
    padding: 0 16px 12px;
    white-space: pre-wrap;
}

.post-image {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
}

.post-actions {
    padding: 4px 12px;
    border-top: 1px solid var(--color-border);
    display: flex;
}

.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    font-size: 0.9rem;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
}

.like-btn:hover {
    background: var(--color-bg);
}

.like-btn.liked {
    color: #E76F51;
}

.delete-btn {
    color: var(--color-muted);
    opacity: 0.6;
}

.delete-btn:hover {
    color: #B3261E;
    opacity: 1;
}

/* Kategorie-Auswahl (Vereinsformular) */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px;
    margin-top: 6px;
}

.category-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    font-size: 0.9rem;
    margin: 0;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    cursor: pointer;
}

.category-option input {
    width: auto;
}

/* Kategorie-Chips (Folgen/Ausblenden in Einstellungen, Tags im Vereinsprofil) */
.category-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.category-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.category-chip button {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--color-text);
}

.category-chip button.active-follow {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(42, 157, 143, 0.08);
}

.category-chip button.active-hidden {
    border-color: #E76F51;
    color: #E76F51;
    background: rgba(231, 111, 81, 0.08);
    text-decoration: line-through;
}

.category-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    flex-shrink: 0;
}

.category-icon-badge .category-icon {
    width: 11px;
    height: 11px;
}

.category-chip button .category-icon-badge {
    margin-right: 2px;
}

.category-option .category-icon-badge {
    width: 20px;
    height: 20px;
}

.category-option .category-icon-badge .category-icon {
    width: 12px;
    height: 12px;
}

/* Tabs (Profil) */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 12px;
}

.tab {
    padding: 10px 14px;
    color: var(--color-muted);
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
}

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

.post-tags {
    padding: 0 16px 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.8rem;
}

.tag {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 3px 10px;
    color: var(--color-muted);
}

.tag-club {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.tag-group {
    color: #8338EC;
    border-color: #8338EC;
}

/* Kommentare */
.avatar-xs {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
}

.post-comments {
    padding: 0 16px 12px;
    border-top: 1px solid var(--color-border);
}

.comments-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    font-size: 0.85rem;
    padding: 8px 0 4px;
    font-weight: 600;
}

.comments-toggle:hover {
    color: var(--color-text);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.comment {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-bubble {
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 0.9rem;
}

.comment-author {
    font-weight: 600;
    margin-right: 6px;
}

.comment-content {
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-meta {
    font-size: 0.75rem;
    color: var(--color-muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    opacity: 0.6;
    font-size: 0.75rem;
    padding: 0;
}

.comment-delete:hover {
    color: #B3261E;
    opacity: 1;
}

.comment-form {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.comment-form input {
    flex: 1;
}

/* Club cards / list */
.club-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.club-card:last-child {
    border-bottom: none;
}

.club-card-info {
    flex: 1;
}

.club-card-name {
    font-weight: 600;
}

.club-card-meta {
    font-size: 0.85rem;
    color: var(--color-muted);
}

.cover {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--color-border);
}

.profile-header {
    display: flex;
    gap: 16px;
    align-items: center;
}

.profile-name {
    font-size: 1.3rem;
    font-weight: 700;
}

.profile-username {
    color: var(--color-muted);
    font-size: 0.9rem;
}

.muted {
    color: var(--color-muted);
    font-size: 0.9rem;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.85rem;
}

.chip a {
    color: inherit;
}

.chip .remove {
    color: var(--color-muted);
    font-weight: 700;
}

.empty-state {
    text-align: center;
    color: var(--color-muted);
    padding: 32px 16px;
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 10px;
}

@media (max-width: 600px) {
    .topnav {
        gap: 10px;
        font-size: 0.85rem;
    }
}

/* Post-Composer: Trigger-Leiste (FB/Twitter-Stil) */
.composer-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.composer-trigger-text {
    flex: 1;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 10px 16px;
    color: var(--color-muted);
}

.composer-trigger:hover .composer-trigger-text {
    background: var(--color-border);
}

.composer-trigger-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--color-muted);
    line-height: 1;
    padding: 4px;
}

/* Stadt-Bloecke (Feed-Einstellungen) – Pinterest/StyleShare-Kacheln */
.city-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.city-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 3 / 4;
    cursor: pointer;
    border: 2px solid transparent;
    display: block;
    width: 100%;
    padding: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-align: left;
    box-shadow: var(--shadow);
    transition: transform 0.15s ease;
}

.city-card:active {
    transform: scale(0.97);
}

.city-card.followed {
    border-color: var(--color-primary);
}

.city-card-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.city-card-cover.placeholder {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
}

.city-card-skyline {
    width: 130%;
    max-width: none;
    height: auto;
    transform: translateY(8%);
    opacity: 0.9;
}

.grad-0 { background: linear-gradient(160deg, #2A9D8F, #21807a); }
.grad-1 { background: linear-gradient(160deg, #F4A261, #E76F51); }
.grad-2 { background: linear-gradient(160deg, #577590, #43AA8B); }
.grad-3 { background: linear-gradient(160deg, #9B5DE5, #F15BB5); }
.grad-4 { background: linear-gradient(160deg, #3A86FF, #8338EC); }
.grad-5 { background: linear-gradient(160deg, #FFB703, #FB8500); }

.city-card-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 12px 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.25) 60%, transparent 100%);
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
    line-height: 1.2;
}

.city-card-sub {
    font-weight: 400;
    font-size: 0.75rem;
    opacity: 0.85;
    margin-top: 2px;
}

/* Messages / Chat */
.msg-unread-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    vertical-align: middle;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
}

.chat-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
}

.chat-bubble-own {
    align-self: flex-end;
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.chat-bubble-other {
    align-self: flex-start;
}

.chat-bubble-sender {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 2px;
    opacity: 0.8;
}

.chat-bubble-content {
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-bubble-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

#dm_search_results {
    margin-top: 8px;
}

.city-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Post-Composer: Zusatzfelder für Event-/Match-Posts */
.composer-extra-fields {
    margin-top: 8px;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
}

/* Event-Posts: Poster mit Farbverlauf-Overlay */
.event-card {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: 8px 0;
}

.event-poster {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
}

.event-card .event-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
    color: #fff;
}

.event-card-noimg {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
}

.event-card-noimg .event-overlay {
    position: static;
    background: none;
    color: #fff;
}

.event-badge {
    display: inline-block;
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    padding: 3px 10px;
    margin-bottom: 6px;
}

.event-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.event-meta {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 2px;
}

/* Match-Posts: Kategorie-Branding mit Farbverlauf */
.match-card {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin: 8px 0;
    padding: 24px 16px;
    color: #fff;
}

.match-icon {
    position: absolute;
    top: 4px;
    left: 8px;
    font-size: 2.8rem;
    line-height: 1;
    opacity: 0.35;
}

.match-body {
    position: relative;
    z-index: 1;
}

.match-tag {
    text-align: center;
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    opacity: 0.85;
    margin-bottom: 6px;
}

.match-teams {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    text-align: center;
}

.match-team {
    font-weight: 700;
    font-size: 1.05rem;
}

.match-score {
    font-weight: 800;
    font-size: 1.6rem;
}

.match-team-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    text-decoration: none;
}

.match-team-link:hover {
    text-decoration: underline;
}

/* RSVP-Buttons (Zusage/Vielleicht/Absage) bei Event-Posts */
.rsvp-section {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 16px;
    border-top: 1px solid var(--color-border);
}

.rsvp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    cursor: pointer;
    color: var(--color-muted);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
}

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

.rsvp-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.rsvp-count {
    font-weight: 700;
}

/* Sub-Post-Teaser + "mehr anzeigen"-Button unter Event-/Match-Posts */
.subpost-teaser {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-top: 1px solid var(--color-border);
    color: inherit;
    text-decoration: none;
}

.subpost-teaser:hover {
    background: var(--color-bg);
}

.subpost-teaser-body {
    flex: 1;
    min-width: 0;
}

.subpost-teaser-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.subpost-teaser-text {
    color: var(--color-muted);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.subpost-teaser-image {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.subpost-teaser-likes {
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--color-muted);
}

.subpost-more-btn {
    display: block;
    text-align: center;
    padding: 10px 16px;
    border-top: 1px solid var(--color-border);
    color: var(--color-primary);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
}

.subpost-more-btn:hover {
    background: var(--color-bg);
}

/* Site-Footer mit Impressum-Link */
.site-footer {
    max-width: var(--max-width);
    margin: 24px auto 0;
    padding: 16px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-muted);
}

.site-footer a {
    color: var(--color-muted);
}
