:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --accent-color: #81C784;
    --bg-color: #121212;
    --surface-color: #1E1E1E;
    --text-color: #E0E0E0;
    --text-secondary: #B0B0B0;
    --border-radius: 12px;
    --glass-bg: rgba(30, 30, 30, 0.8);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 15px;
    padding: 5px 0;
    /* Reduced top padding */
}

header h1 {
    font-size: 2rem;
    color: var(--primary-color);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    margin: 0;
    /* Force remove default margin */
}

/* Form Styles */
.user-form-section {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: var(--glass-border);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.user-form-section h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--accent-color);
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

input,
select {
    width: 100%;
    padding: 12px;
    background-color: #2C2C2C;
    border: 1px solid #444;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

input:focus,
select:focus {
    border-color: var(--primary-color);
}

.date-inputs {
    display: flex;
    gap: 10px;
}

.date-inputs input,
.date-inputs select {
    flex: 1;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

.submit-btn:hover {
    background-color: var(--primary-dark);
}

.submit-btn:active {
    transform: scale(0.98);
}

/* Posts Section */
.posts-section {
    margin: 0;
    padding: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0;
    padding-top: 0;
    margin-bottom: 3px;
    padding-bottom: 3px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.posts-section h2 {
    font-size: 1.2rem;
    margin: 0;
    line-height: 1.1;
    /* Reduced line height */
    color: var(--accent-color);
}

.hiking-list-container {
    margin-top: 0;
    padding-top: 0;
    margin-bottom: 5px;
    padding: 0;
}

.header-more-btn {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    transition: all 0.2s;
}

.header-more-btn:hover {
    background: var(--primary-color);
    color: white;
}

/* Accordion */
.accordion-container {
    background: var(--glass-bg);
    border: var(--glass-border);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    overflow: hidden;
}

.accordion-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.05);
}

.accordion-header:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: rgba(0, 0, 0, 0.2);
}

.accordion-content.open {
    max-height: 500px;
    /* Arbitrary large height */
    overflow-y: auto;
}

/* Post Items */
.post-item {
    padding: 10px;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 12px;
}

.post-item:last-child,
.post-item:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
    /* Tighten bottom spacing */
}

.post-tag {
    /* Fixed width for alignment */
    width: 60px;
    text-align: center;
    flex-shrink: 0;
    padding: 4px 0;
    /* Adjusted vertical padding */
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    align-self: flex-start;
    /* Align tag to top if content is tall */
    margin-top: 2px;
}

.tag-notice {
    background-color: #E53935;
    color: white;
}

/* Club Announcement */
.tag-hike {
    background-color: #FB8C00;
    color: white;
}

/* Hiking Notice */
.tag-review {
    background-color: #1E88E5;
    color: white;
}

/* Event */
.tag-event {
    background-color: #9C27B0;
    /* Purple */
    color: white;
}

/* Review */

.post-content {
    flex: 1;
    /* Take remaining space */
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.post-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
}

.post-meta {
    font-size: 0.8rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 8px;
    /* Spacing between author and date */
}

.post-meta-divider {
    color: #555;
    font-size: 0.7rem;
}

.post-deadline {
    color: #ff6b6b;
    font-size: 0.85rem;
    font-weight: bold;
    margin-top: 4px;
    display: block;
}

/* Hiking List */
.hiking-list-container {
    background: var(--glass-bg);
    /* Default for Notice */
    border: var(--glass-border);
    border-radius: var(--border-radius);
    padding: 20px;
}

/* Specific override removed */

.load-more-btn {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.load-more-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.hidden {
    display: none;
}

/* Floating Action Button */
.fab-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    text-decoration: none;
    transition: transform 0.2s, background-color 0.2s;
    z-index: 100;
}

.fab-btn:hover {
    transform: scale(1.1);
    background-color: var(--primary-dark);
}

/* Community Links Grid */
.community-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* Mobile default: 2 columns */
    gap: 10px;
    margin-bottom: 5px;
    /* Reduced from 30px */
}

/* On screens larger than 500px, show 4 columns */
@media (min-width: 500px) {
    .community-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.community-btn {
    color: white;
    padding: 8px;
    /* Reduced specific padding */
    border-radius: 10px;
    text-decoration: none;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
    min-height: 60px;
    /* Reduced height */
}

.community-btn:hover {
    transform: translateY(-2px);
}

.community-btn i,
.community-btn svg {
    font-size: 1.2rem !important;
    /* Reduced icon size */
    width: 1.2rem !important;
    height: 1.2rem !important;
    margin-bottom: 3px !important;
    fill: white;
}

.community-btn span {
    font-size: 0.75rem !important;
    /* Reduced text size */
    font-weight: bold;
    line-height: 1.1;
}

.btn-venmo {
    background: #3D95CE;
}

.btn-insta {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.btn-daum {
    background: #2962FF;
}

.btn-kakao {
    background: #FEE500;
    color: #3C1E1E !important;
}

.btn-kakao i {
    color: #3C1E1E !important;
}

/* Header & Controls Refactoring */
.header-layout {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 5px;
    /* Reduced from 30px */
}

.header-title-container {
    text-align: center;
}

.header-title-container h1 {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header-logo {
    height: 60px;
    border-radius: 50%;
}

.header-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.controls-left {
    display: flex;
    gap: 5px;
    align-items: center;
}

.admin-controls-group {
    display: none;
    gap: 5px;
}

.btn-small {
    font-size: 0.8rem;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.btn-gray {
    color: white;
    background-color: #555;
}

.btn-primary-small {
    color: white;
    background-color: var(--primary-color);
}

.user-info-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-greeting {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.btn-profile {
    font-size: 0.8rem;
    text-decoration: none;
    color: white;
    background-color: #555;
    padding: 5px 10px;
    border-radius: 5px;
}

.btn-logout {
    background: #444;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
}

/* Modal Overlay */
.rename-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

/* Modal Box */
.rename-modal-box {
    background: #2D2D2D;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    border: 1px solid #444;
}

.rename-modal-title {
    margin-top: 0;
    margin-bottom: 15px;
    color: white;
}

.rename-modal-text {
    color: #bbb;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.rename-modal-warning {
    font-size: 0.8rem;
    color: #888;
}

.rename-modal-input {
    width: 100%;
    margin-bottom: 20px;
}

.rename-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-modal-cancel {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #555;
    background: transparent;
    color: #ddd;
    cursor: pointer;
}

.btn-modal-confirm {
    padding: 8px 16px;
}

/* =========================================
   Global Mobile UX Improvements (Max 600px)
   ========================================= */
@media (max-width: 600px) {

    /* 1. Header Layout: Stack Vertical */
    .header-controls-row {
        flex-direction: column;
        gap: 5px;
        /* Reduced from 15px */
        align-items: stretch;
        /* Full width children */
    }

    .controls-left {
        justify-content: center;
        flex-wrap: wrap;
        /* Allow buttons to wrap if needed */
        width: 100%;
    }

    .user-info-area {
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
        background: rgba(255, 255, 255, 0.03);
        padding: 10px;
        border-radius: 8px;
    }

    /* 2. Post List as Cards */
    .post-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        background: rgba(255, 255, 255, 0.02);
        border-radius: 8px;
        margin-bottom: 10px;
        /* Spacing between cards */
        border-bottom: none;
        /* Remove separator line */
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    }

    .post-content {
        width: 100%;
    }

    .post-title {
        font-size: 1.1rem;
        /* Larger title for touch targets */
        margin-bottom: 5px;
        display: block;
    }

    .post-meta {
        flex-wrap: wrap;
        /* Allow meta info to wrap */
        gap: 8px;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        /* Separator inside card */
        width: 100%;
    }

    /* 3. Forms: Vertical Stack */
    .date-inputs,
    .form-group>div {
        flex-direction: column;
        align-items: stretch !important;
    }

    .time-select-group {
        width: 100%;
        margin-top: 5px;
    }

    /* 4. Touch Targets: Bigger Buttons */
    .btn-small,
    .btn-profile,
    .btn-logout {
        padding: 10px 16px;
        /* Larger padding */
        font-size: 0.95rem;
    }

    .header-logo {
        height: 50px;
        /* Slightly smaller logo header */
    }
}

/* =========================================
   Login View Styles (SPA Integrated)
   ========================================= */
.login-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 20px;
}

.login-card {
    background: rgba(40, 40, 40, 0.95);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.logo-area {
    margin-bottom: 40px;
}

.logo-text {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 5px;
}

.btn-google {
    width: 100%;
    padding: 12px;
    border-radius: 24px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
    height: auto;
    /* Allow growth */
    line-height: 1.4;
    text-align: center;
}

.btn-google:hover {
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.2);
    background-color: #f8f8f8;
}

/* =========================================
   Structured Post Content Support
   ========================================= */
.post-section-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #66BB6A;
    /* Light Green */
    margin-top: 25px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 8px;
}

.post-info-list {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.post-info-item {
    display: flex;
    margin-bottom: 10px;
    font-size: 0.95rem;
    flex-wrap: wrap;
    /* Safe wrap for mobile */
}

.post-info-key {
    font-weight: bold;
    color: #e0e0e0;
    min-width: 100px;
    margin-right: 5px;
}

.post-info-value {
    color: #ccc;
    flex: 1;
    min-width: 200px;
    /* Force wrap if too narrow */
    line-height: 1.4;
}

.post-info-value a {
    color: #4eadca;
    text-decoration: underline;
}

.attendee-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    color: #ffd700;
    margin-left: 8px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}