/* ===== Reset & Basis ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #f0f2f5;
    color: #1c1e21;
    line-height: 1.5;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: #1877f2;
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== Navbar ===== */
.navbar {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 56px;
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    gap: 12px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1877f2;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

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

.nav-links {
    display: flex;
    gap: 4px;
    align-items: center;
}

.nav-links a {
    color: #65676b;
    font-weight: 500;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    transition: background 0.15s;
    font-size: 0.95rem;
    white-space: nowrap;
}

.nav-links a:hover {
    background: #f0f2f5;
    text-decoration: none;
}

.admin-link {
    color: #e41e3f !important;
}

.logout-btn {
    color: #e41e3f !important;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* Hamburger (Mobile) */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #1c1e21;
    margin: 5px 0;
    border-radius: 1px;
    transition: 0.2s;
}

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 500;
    font-size: 0.95rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ===== Auth Seiten ===== */
.auth-container {
    max-width: 420px;
    margin: 40px auto;
    background: #fff;
    padding: 28px 24px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.auth-container h1 {
    text-align: center;
    margin-bottom: 8px;
    color: #1877f2;
    font-size: 1.7rem;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #dddfe2;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1877f2;
    box-shadow: 0 0 0 2px rgba(24,119,242,0.2);
}

.btn {
    display: inline-block;
    padding: 11px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    text-align: center;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #1877f2;
    color: #fff;
}

.btn-primary:hover {
    background: #166fe5;
}

.btn-secondary {
    background: #e4e6eb;
    color: #050505;
}

.btn-secondary:hover {
    background: #d8dadf;
}

.btn-danger {
    background: #e41e3f;
    color: #fff;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
    color: #65676b;
    font-size: 0.95rem;
}

/* ===== Layout ===== */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    margin-top: 20px;
    margin-bottom: 40px;
    align-items: start;
}

/* ===== Post Form ===== */
.post-box {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 16px;
}

.post-box textarea {
    width: 100%;
    border: none;
    resize: none;
    font-size: 1.05rem;
    min-height: 70px;
    padding: 8px 0;
    outline: none;
    font-family: inherit;
    line-height: 1.4;
}

.post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e4e6eb;
    padding-top: 12px;
    margin-top: 4px;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== Posts / Wall ===== */
.post {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 14px;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.post-meta {
    flex: 1;
    min-width: 0;
}

.post-author {
    font-weight: 600;
    color: #050505;
    text-decoration: none;
    display: block;
}

.post-author:hover {
    text-decoration: underline;
}

.post-time {
    font-size: 0.82rem;
    color: #65676b;
}

.post-menu {
    margin-left: auto;
    position: relative;
}

.post-menu-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #65676b;
    padding: 4px 8px;
    border-radius: 50%;
    line-height: 1;
}

.post-menu-btn:hover {
    background: #f0f2f5;
}

.post-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    min-width: 140px;
    z-index: 50;
    overflow: hidden;
}

.post-menu-dropdown.show {
    display: block;
}

.post-menu-dropdown button,
.post-menu-dropdown a {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    background: none;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
    color: #1c1e21;
    text-decoration: none;
}

.post-menu-dropdown button:hover,
.post-menu-dropdown a:hover {
    background: #f0f2f5;
}

.post-menu-dropdown .danger {
    color: #e41e3f;
}

.post-content {
    margin-bottom: 12px;
    font-size: 1.02rem;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.45;
}

.post-stats {
    display: flex;
    gap: 14px;
    padding: 8px 0;
    border-top: 1px solid #e4e6eb;
    border-bottom: 1px solid #e4e6eb;
    margin-bottom: 6px;
    font-size: 0.88rem;
    color: #65676b;
}

.post-actions-bar {
    display: flex;
    gap: 4px;
}

.action-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 8px 6px;
    border-radius: 6px;
    font-weight: 600;
    color: #65676b;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}

.action-btn:hover {
    background: #f0f2f5;
}

.action-btn.liked {
    color: #1877f2;
}

/* ===== Kommentare ===== */
.comments-section {
    margin-top: 10px;
}

.comment {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-body {
    background: #f0f2f5;
    padding: 8px 12px;
    border-radius: 18px;
    flex: 1;
    min-width: 0;
}

.comment-author {
    font-weight: 600;
    font-size: 0.88rem;
    color: #050505;
    text-decoration: none;
}

.comment-text {
    font-size: 0.92rem;
    word-break: break-word;
}

.comment-time {
    font-size: 0.78rem;
    color: #65676b;
    margin-left: 6px;
}

.comment-form {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    align-items: center;
}

.comment-form input {
    flex: 1;
    padding: 9px 14px;
    border: none;
    background: #f0f2f5;
    border-radius: 20px;
    font-size: 0.92rem;
    font-family: inherit;
}

.comment-form input:focus {
    outline: none;
    background: #e4e6eb;
}

.comment-form button {
    background: #1877f2;
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* ===== Sidebar ===== */
.sidebar-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 14px;
}

.sidebar-card h3 {
    font-size: 1.05rem;
    margin-bottom: 12px;
    color: #050505;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f2f5;
}

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

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.member-name {
    font-weight: 500;
    color: #050505;
    text-decoration: none;
    font-size: 0.95rem;
}

.member-name:hover {
    text-decoration: underline;
}

/* ===== Profil ===== */
.profile-cover {
    background: linear-gradient(135deg, #1877f2 0%, #0d5bbd 50%, #42b72a 100%);
    height: 200px;
    border-radius: 12px 12px 0 0;
    position: relative;
}

.profile-header {
    background: #fff;
    border-radius: 0 0 12px 12px;
    padding: 0 24px 24px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    position: relative;
}

.profile-avatar-wrap {
    position: relative;
    display: inline-block;
    margin-top: -60px;
    margin-bottom: 12px;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    background: #e4e6eb;
    display: block;
}

.avatar-upload-btn {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1877f2;
    color: #fff;
    border: 2px solid #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    padding: 0;
}

.avatar-upload-btn:hover {
    background: #166fe5;
}

.profile-info h1 {
    font-size: 1.7rem;
    margin-bottom: 2px;
    line-height: 1.2;
}

.profile-info .username {
    color: #65676b;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.profile-bio {
    margin-top: 8px;
    color: #1c1e21;
    font-size: 0.95rem;
    max-width: 500px;
}

.profile-meta {
    margin-top: 10px;
    color: #65676b;
    font-size: 0.88rem;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    align-items: center;
}

.profile-stats {
    display: flex;
    gap: 24px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e4e6eb;
}

.profile-stat {
    text-align: center;
}

.profile-stat .num {
    font-size: 1.25rem;
    font-weight: 700;
    color: #050505;
    display: block;
}

.profile-stat .label {
    font-size: 0.85rem;
    color: #65676b;
}

.profile-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== Members Page ===== */
.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 16px;
    margin-bottom: 40px;
}

.member-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: transform 0.15s, box-shadow 0.15s;
}

.member-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.member-card img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
}

.member-card h3 {
    font-size: 1.05rem;
    margin-bottom: 2px;
}

.member-card .role {
    font-size: 0.85rem;
    color: #65676b;
}

/* ===== Admin ===== */
.admin-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.admin-nav a {
    padding: 9px 16px;
    background: #e4e6eb;
    border-radius: 8px;
    color: #050505;
    font-weight: 500;
    text-decoration: none;
    font-size: 0.9rem;
}

.admin-nav a.active,
.admin-nav a:hover {
    background: #1877f2;
    color: #fff;
    text-decoration: none;
}

.admin-table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.admin-table {
    width: 100%;
    background: #fff;
    border-collapse: collapse;
    min-width: 600px;
}

.admin-table th,
.admin-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #e4e6eb;
    font-size: 0.9rem;
}

.admin-table th {
    background: #f0f2f5;
    font-weight: 600;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-admin {
    background: #e41e3f;
    color: #fff;
}

.badge-user {
    background: #e4e6eb;
    color: #050505;
}

.badge-active {
    background: #d4edda;
    color: #155724;
}

.badge-banned {
    background: #f8d7da;
    color: #721c24;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 24px 0;
    color: #65676b;
    font-size: 0.88rem;
    margin-top: 20px;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #65676b;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.empty-state h3 {
    margin-bottom: 6px;
    color: #1c1e21;
}

/* ===== Edit Profile Form ===== */
.edit-profile-box {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.edit-profile-box h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ===== Page Title ===== */
.page-title {
    margin: 20px 0 12px;
    font-size: 1.4rem;
}

/* ========================================
   RESPONSIVE – Tablet
   ======================================== */
@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .sidebar-card {
        display: none;
    }

    /* Sidebar auf Tablet optional anzeigen */
    .sidebar-show-mobile {
        display: block !important;
    }

    .profile-cover {
        height: 160px;
    }

    .profile-avatar {
        width: 100px;
        height: 100px;
    }

    .profile-avatar-wrap {
        margin-top: -50px;
    }

    .profile-info h1 {
        font-size: 1.45rem;
    }
}

/* ========================================
   RESPONSIVE – Handy
   ======================================== */
@media (max-width: 640px) {
    .container {
        padding: 0 10px;
    }

    /* Mobile Navigation */
    .nav-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: #fff;
        flex-direction: column;
        padding: 8px 0;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        gap: 0;
        border-top: 1px solid #e4e6eb;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        padding: 14px 20px;
        border-radius: 0;
        width: 100%;
        font-size: 1rem;
    }

    .nav-links a:hover {
        background: #f0f2f5;
    }

    .nav-user span {
        display: none;
    }

    .logo {
        font-size: 1.3rem;
    }

    /* Auth */
    .auth-container {
        margin: 20px 10px;
        padding: 24px 18px;
    }

    /* Posts */
    .post {
        padding: 14px;
        border-radius: 10px;
    }

    .post-box {
        padding: 14px;
        border-radius: 10px;
    }

    .post-content {
        font-size: 0.98rem;
    }

    .action-btn {
        font-size: 0.85rem;
        padding: 8px 4px;
    }

    .comment-form {
        flex-wrap: wrap;
    }

    .comment-form button {
        width: 100%;
        border-radius: 8px;
        margin-top: 4px;
    }

    /* Profile */
    .profile-cover {
        height: 120px;
        border-radius: 10px 10px 0 0;
    }

    .profile-header {
        padding: 0 14px 18px;
        border-radius: 0 0 10px 10px;
    }

    .profile-avatar {
        width: 88px;
        height: 88px;
    }

    .profile-avatar-wrap {
        margin-top: -44px;
    }

    .profile-info h1 {
        font-size: 1.3rem;
    }

    .profile-stats {
        gap: 16px;
    }

    .profile-stat .num {
        font-size: 1.1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Members */
    .members-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }

    .member-card {
        padding: 16px 12px;
    }

    .member-card img {
        width: 60px;
        height: 60px;
    }

    /* Admin */
    .admin-nav a {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .footer {
        font-size: 0.8rem;
        padding: 20px 10px;
    }
}

/* Sehr kleine Geräte */
@media (max-width: 380px) {
    .action-btn {
        font-size: 0.8rem;
        gap: 3px;
    }

    .members-grid {
        grid-template-columns: 1fr 1fr;
    }
}
