/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #e84057;
    --primary-hover: #d6293f;
    --bg: #f5f5f7;
    --card-bg: #ffffff;
    --text: #1d1d1f;
    --text-muted: #86868b;
    --border: #e5e5e7;
    --success: #34c759;
    --warning: #ff9500;
    --error: #ff3b30;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
    --transition: 0.2s ease;
    --nav-bg: rgba(255,255,255,0.72);
    --nav-border: rgba(0,0,0,0.08);
    --nav-shadow: rgba(0,0,0,0.04);
    --hover-overlay: rgba(0,0,0,0.04);
}

[data-theme="dark"] {
    --primary: #ff6b7f;
    --primary-hover: #ff8a9a;
    --bg: #1a1a1e;
    --card-bg: #2c2c30;
    --text: #f0f0f2;
    --text-muted: #98989f;
    --border: #3a3a3e;
    --success: #30d158;
    --warning: #ffa00a;
    --error: #ff453a;
    --shadow: 0 2px 12px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.4);
    --nav-bg: rgba(28,28,32,0.82);
    --nav-border: rgba(255,255,255,0.08);
    --nav-shadow: rgba(0,0,0,0.2);
    --hover-overlay: rgba(255,255,255,0.06);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* === Navbar === */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    box-shadow: 0 1px 3px var(--nav-shadow);
}

.nav-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 5px;
}
.nav-brand:hover {
    background: var(--hover-overlay);
    border-radius: 8px;
}

.nav-name-img { height: 32px; width: auto; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    transition: all var(--transition);
}
.nav-link:hover {
    color: var(--text);
    background: var(--hover-overlay);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text);
    padding-left: 0.5rem;
    margin-left: 0.25rem;
    border-left: 1px solid var(--border);
}

.nav-logout {
    margin-left: 0.1rem;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.4rem;
    border-radius: 8px;
    transition: background var(--transition);
    line-height: 1;
}
.theme-toggle:hover {
    background: var(--hover-overlay);
}

[data-theme="dark"] .nav-name-img {
    filter: invert(1);
}

[data-theme="dark"] .empty-icon {
    filter: invert(1) hue-rotate(180deg);
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232,64,87,0.3);
}

.btn-lg { padding: 0.75rem 1.8rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* === Avatar === */
.avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

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

/* === Container === */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* === Hero === */
.hero {
    text-align: center;
    padding: 3rem 1rem 2.5rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* === Section === */
.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

/* === Posts Grid === */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 1.5rem;
}

/* === Post Card === */
.post-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition), transform var(--transition);
}

.post-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.post-video {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    background: #000;
}

.post-video iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
}

.post-image img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.post-body {
    padding: 1rem 1.25rem 1.25rem;
}

.post-author {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.author-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}
.author-link:hover { color: var(--primary); }

.post-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.post-title a {
    color: var(--text);
}
.post-title a:hover {
    color: var(--primary);
}

.post-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

/* === Interest Buttons === */
.post-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.btn-interest {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.9rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1.5px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}

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

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

.btn-interest.disabled {
    cursor: default;
    opacity: 0.7;
}

.interest-icon { font-size: 1rem; }
.interest-count {
    background: var(--hover-overlay);
    padding: 0.1rem 0.45rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.btn-interest.active .interest-count {
    background: rgba(255,255,255,0.25);
}

.btn-edit {
    padding: 0.35rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1.5px solid var(--primary);
    color: var(--primary);
    transition: all var(--transition);
    margin-left: auto;
}
.btn-edit:hover {
    background: var(--primary);
    color: #fff;
}

.btn-delete {
    padding: 0.35rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1.5px solid var(--error);
    background: transparent;
    color: var(--error);
    cursor: pointer;
    transition: all var(--transition);
    margin-left: auto;
}
.btn-delete:hover {
    background: var(--error);
    color: #fff;
}

/* === Form === */
.form-page {
    max-width: 560px;
    margin: 0 auto;
}

.form-page h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.form-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.event-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}

.form-group input[type="url"],
.form-group input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color var(--transition);
    background: var(--card-bg);
}

.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color var(--transition);
    background: var(--card-bg);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}


.form-group small {
    display: block;
    margin-top: 0.3rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.btn-secondary {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-muted);
}
.btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.form-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.current-image {
    margin-bottom: 1rem;
}

.current-image img {
    max-width: 200px;
    border-radius: var(--radius-sm);
}

.remove-image-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--error);
    cursor: pointer;
}

/* File upload */
.file-upload {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    transition: border-color var(--transition), background var(--transition);
    cursor: pointer;
}

.file-upload:hover, .file-upload.dragover {
    border-color: var(--primary);
    background: rgba(232,64,87,0.03);
}

.file-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-upload-icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.file-upload-label span { display: block; }
.file-upload-label small { color: var(--text-muted); }

.image-preview {
    max-width: 200px;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
}

/* === Profile === */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.profile-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
}

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

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}

.empty-icon {
    width: 80px;
    opacity: 0.5;
    margin-bottom: 1rem;
}

.empty-state h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

/* === Flash Messages === */
.flash {
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}
.flash-success { background: #e8f9ed; color: #1a7a34; }
.flash-error { background: #ffeae9; color: #c62828; }
.flash-warning { background: #fff3e0; color: #e65100; }
.flash-info { background: #e3f2fd; color: #1565c0; }

[data-theme="dark"] .flash-success { background: #1a3a24; color: #6ee7a0; }
[data-theme="dark"] .flash-error { background: #3a1a18; color: #ff8a80; }
[data-theme="dark"] .flash-warning { background: #3a2e1a; color: #ffcc80; }
[data-theme="dark"] .flash-info { background: #1a2a3a; color: #80b4ff; }

/* === Event Detail === */
.event-detail {
    max-width: 700px;
    margin: 0 auto;
}

.event-video {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
}

.event-video iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
}

.event-image img {
    width: 100%;
    border-radius: var(--radius);
    margin-top: 1rem;
}

.event-info {
    margin-top: 1.5rem;
}

.event-info h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.event-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.event-description {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

.event-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.25rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-count {
    font-size: 1.5rem;
    font-weight: 800;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.event-people {
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.people-section h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.people-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.person {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: var(--bg);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    transition: background var(--transition);
}

.person:hover {
    background: var(--hover-overlay);
    color: var(--text);
}

/* === Danger Zone === */
.danger-zone {
    margin-top: 3rem;
    padding: 1.5rem;
    border: 1.5px solid var(--error);
    border-radius: var(--radius);
    background: var(--card-bg);
}

.danger-zone h3 {
    font-size: 1rem;
    color: var(--error);
    margin-bottom: 0.25rem;
}

.danger-zone p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* === About === */
.about-page h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
}

.about-content {
    max-width: 640px;
}

.about-content p {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 1rem;
    text-align: justify;
}

.about-video {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    margin-top: 1.5rem;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}

.about-video iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
}

.about-video-fallback {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* === Responsive === */
@media (max-width: 640px) {
    .navbar { padding: 0 1rem; }
    .nav-name-img { height: 26px; }
    .hero h1 { font-size: 1.8rem; }
    .posts-grid { grid-template-columns: 1fr; }
    .container { padding: 1.5rem 1rem; }
    .profile-header { flex-direction: column; text-align: center; }
    .nav-user span { display: none; }
}
