@font-face {
    font-family: 'Ezhuthu';
    src: url('RIT-Ezhuthu-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

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

:root {
    --bg: #fafafa;
    --bg-card: #ffffff;
    --text: #171717;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --primary: #171717;
    --primary-hover: #404040;
    --accent: #2563eb;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0a0a0a;
        --bg-card: #171717;
        --text: #ededed;
        --text-muted: #a1a1aa;
        --border: #27272a;
        --primary: #ededed;
        --primary-hover: #d4d4d8;
        --accent: #60a5fa;
        --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

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

@media (min-width: 640px) {
    .container { padding: 0 20px; }
}

.container-sm {
    max-width: 600px;
}

/* Header */
.header {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    position: relative;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

@media (min-width: 640px) {
    .header .container { height: 60px; }
}

/* Navigation */
.nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text);
    background: var(--border);
}

.nav-link.active {
    color: var(--text);
}

.nav-admin {
    border: 1px solid var(--border);
    margin-left: 8px;
}

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.2s ease;
}

.mobile-menu-btn.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-btn.open span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .nav {
        display: none;
        position: absolute;
        top: 100%;
        left: -16px;
        right: -16px;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 8px 16px 16px;
        gap: 2px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }

    .nav.open {
        display: flex;
    }

    .nav-link {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
        text-align: left;
    }

    .nav-admin {
        margin-left: 0;
        margin-top: 4px;
        text-align: center;
    }

    .btn-logout {
        width: 100%;
        margin-top: 4px;
    }
}

.logo {
    font-family: 'Ezhuthu', serif;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

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

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

.btn-primary {
    background: var(--primary);
    color: var(--bg);
    border-color: var(--primary);
}

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

.btn-ghost {
    border: none;
    background: transparent;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
    min-height: 32px;
}

.btn-logout {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-size: 0.75rem;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: var(--radius);
    min-height: 32px;
}

.btn-logout:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

.btn-block {
    width: 100%;
}

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

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

/* Hero */
.hero {
    padding: 32px 0 24px;
}

@media (min-width: 640px) {
    .hero { padding: 48px 0 32px; }
}

.hero h1 {
    font-family: 'Ezhuthu', serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

@media (min-width: 640px) {
    .hero h1 { font-size: 2.5rem; }
}

.hero p {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

@media (min-width: 640px) {
    .hero p { font-size: 1rem; }
}

/* Event Grid */
.event-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding-bottom: 48px;
}

@media (min-width: 640px) {
    .event-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (min-width: 960px) {
    .event-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Event Card */
.event-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

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

.event-card:active {
    transform: scale(0.99);
}

.event-banner {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: var(--border);
    display: block;
}

.event-banner-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--border) 0%, var(--bg) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.event-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

@media (min-width: 640px) {
    .event-body { padding: 16px; }
}

.event-organizer {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    margin-bottom: 6px;
    display: inline-block;
}

.event-organizer:hover {
    text-decoration: underline;
}

.event-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.event-location {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    padding-left: 14px;
    position: relative;
}

.event-location::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
}

.event-title {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
    line-height: 1.4;
}

@media (min-width: 640px) {
    .event-title { font-size: 1rem; }
}

.event-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
    flex: 1;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (min-width: 640px) {
    .event-desc { font-size: 0.875rem; margin-bottom: 16px; }
}

.event-action {
    margin-top: auto;
}

.event-action .btn {
    width: 100%;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 16px;
    display: none;
}

@media (min-width: 640px) {
    .empty-state { padding: 80px 20px; }
}

.empty-state.active {
    display: block;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 16px;
    font-size: 0.9375rem;
}

/* Admin Form */
.admin-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 48px;
}

@media (min-width: 640px) {
    .admin-form { padding: 24px; }
}

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

@media (min-width: 640px) {
    .form-group { margin-bottom: 20px; }
}

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

@media (min-width: 640px) {
    .form-group label { font-size: 0.875rem; }
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.15s ease;
    -webkit-appearance: none;
}

@media (min-width: 640px) {
    .form-group input,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 0.875rem;
    }
}

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

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Admin Events List */
.admin-events {
    margin-bottom: 48px;
}

.admin-events-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

@media (min-width: 640px) {
    .admin-events-title { margin-bottom: 16px; }
}

.admin-event-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-event-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

@media (min-width: 640px) {
    .admin-event-item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 16px;
    }
}

.admin-event-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.admin-event-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

@media (max-width: 639px) {
    .admin-event-actions {
        width: 100%;
    }
    .admin-event-actions .btn {
        flex: 1;
    }
}

.btn-edit {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-edit:hover {
    background: var(--accent);
    color: #fff;
}

.admin-event-title {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-event-organizer {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.admin-empty {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    padding: 24px;
}

.admin-section {
    margin-bottom: 48px;
}

.admin-section-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Community Grid */
.community-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding-bottom: 48px;
}

@media (min-width: 640px) {
    .community-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (min-width: 960px) {
    .community-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.community-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.15s ease;
    min-height: 56px;
    -webkit-tap-highlight-color: transparent;
}

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

.community-card:active {
    transform: scale(0.99);
}

.community-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}

@media (min-width: 640px) {
    .community-icon { width: 44px; height: 44px; font-size: 1.125rem; }
}

.community-info {
    display: flex;
    flex-direction: column;
}

.community-name {
    font-size: 0.875rem;
    font-weight: 600;
}

@media (min-width: 640px) {
    .community-name { font-size: 0.9375rem; }
}

/* Contact */
.contact-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 48px;
}

@media (min-width: 640px) {
    .contact-card { gap: 16px; }
}

.contact-item {
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

@media (min-width: 640px) {
    .contact-item { padding: 20px; }
}

.contact-item h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.contact-item p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.contact-item a {
    color: var(--accent);
    text-decoration: none;
}

.contact-item a:hover {
    text-decoration: underline;
}

/* Organizer Hero */
.organizer-hero {
    text-align: center;
    padding: 32px 0 24px;
}

@media (min-width: 640px) {
    .organizer-hero { padding: 48px 0 32px; }
}

.organizer-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 12px;
}

@media (min-width: 640px) {
    .organizer-avatar { width: 72px; height: 72px; font-size: 1.75rem; margin-bottom: 16px; }
}

.organizer-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}

@media (min-width: 640px) {
    .organizer-name { font-size: 1.875rem; }
}

.organizer-desc {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.6;
    max-width: 520px;
    margin: 0 auto 16px;
}

@media (min-width: 640px) {
    .organizer-desc { font-size: 0.9375rem; }
}

.organizer-social {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.organizer-social-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.15s ease;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
}

.organizer-social-link:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

@media (min-width: 640px) {
    .section-title { font-size: 1.125rem; margin-bottom: 16px; }
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    margin-top: auto;
}

.main {
    flex: 1;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@media (min-width: 640px) {
    .footer { padding: 24px 0; }
}

.footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
    overflow-y: auto;
}

@media (min-width: 640px) {
    .modal-overlay {
        align-items: center;
        padding: 20px;
    }
}

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

.modal {
    background: var(--bg-card);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
}

@media (min-width: 640px) {
    .modal {
        border-radius: var(--radius);
        max-width: 560px;
        max-height: 90vh;
    }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--bg);
    color: var(--text);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.modal-close:hover {
    background: var(--border);
}

.modal-banner {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: var(--border);
    border-radius: 0;
    display: block;
}

@media (min-width: 640px) {
    .modal-banner { border-radius: var(--radius) var(--radius) 0 0; }
}

.modal-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

@media (min-width: 640px) {
    .modal-banner img { border-radius: var(--radius) var(--radius) 0 0; }
}

.modal-banner-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, var(--border) 0%, var(--bg) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.modal-body {
    padding: 16px;
}

@media (min-width: 640px) {
    .modal-body { padding: 24px; }
}

.modal-organizer {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent);
    display: block;
    margin-bottom: 4px;
}

.modal-organizer a {
    color: inherit;
    text-decoration: none;
}

.modal-organizer a:hover {
    text-decoration: underline;
}

.modal-date {
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.modal-location {
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 12px;
    padding-left: 14px;
    position: relative;
}

.modal-location::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--text-muted);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    line-height: 1.3;
}

@media (min-width: 640px) {
    .modal-title { font-size: 1.25rem; margin-bottom: 16px; }
}

.modal-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
}

@media (min-width: 640px) {
    .modal-desc { font-size: 0.9375rem; margin-bottom: 24px; }
}

/* Filter Bar */
.filter-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.filter-bar.active {
    display: flex;
}

.filter-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.filter-name {
    font-weight: 600;
    font-size: 0.875rem;
    flex: 1;
}

/* Utilities */
@media (max-width: 639px) {
    .hide-mobile { display: none !important; }
}
