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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f6f8;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #2c3e50;
    padding: 0.75rem 2rem;
}

nav > a:first-child {
    color: #ecf0f1;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}

.nav-link {
    color: #bdc3c7;
    text-decoration: none;
    margin-left: 1.5rem;
}

.nav-link:hover {
    color: #ecf0f1;
}

main {
    padding: 2rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-right > a {
    color: #ecf0f1;
    text-decoration: none;
}

.nav-right > a:hover {
    color: #3498db;
}

.dropdown {
    position: relative;
}

.dropdown-toggle {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    color: #ecf0f1;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
}

.dropdown-toggle:hover {
    border-color: rgba(255,255,255,0.6);
}

.caret {
    font-size: 0.7rem;
    margin-left: 0.25rem;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 160px;
    z-index: 100;
}

.dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: #333;
    text-decoration: none;
}

.dropdown-menu a:hover {
    background: #f8f9fa;
}

.dropdown-menu hr {
    margin: 0.25rem 0;
    border: none;
    border-top: 1px solid #eee;
}

.dropdown-menu form {
    margin: 0;
    max-width: none;
}

.dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
}

.dropdown-menu button:hover {
    background: #fdf0ef;
}

/* Content */

h1 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

h2 {
    margin-bottom: 0.75rem;
    color: #2c3e50;
}

/* Cards */

.card {
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}

/* Forms */

form {
    max-width: 480px;
}

label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background: white;
}

button[type="submit"] {
    margin-top: 1.5rem;
    padding: 0.5rem 1.5rem;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

button[type="submit"]:hover {
    background: #34495e;
}

/* Alerts */

.error {
    color: #e74c3c;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #fdf0ef;
    border-radius: 4px;
}

.success {
    color: #27ae60;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #eafaf1;
    border-radius: 4px;
}

/* Profile */

.username {
    color: #7f8c8d;
    margin-bottom: 1rem;
}

.bio {
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 4px;
}

.meta {
    color: #95a5a6;
    font-size: 0.9rem;
    margin-top: 1rem;
}

/* Links */

a {
    color: #3498db;
}

/* Definition lists */

dl {
    margin: 1rem 0;
}

dt {
    font-weight: 600;
    margin-top: 0.75rem;
}

dd {
    margin-left: 0;
    color: #555;
}

hr {
    margin: 2rem 0;
    border: none;
    border-top: 1px solid #e1e4e8;
}

/* Tables */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    overflow: hidden;
}

th, td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e1e4e8;
}

th {
    background: #f8f9fa;
    font-weight: 600;
}

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

/* Role badges */

.role-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 500;
}

.role-admin {
    background: #fadbd8;
    color: #c0392b;
}

.role-moderator {
    background: #d4efdf;
    color: #27ae60;
}

.role-community_organizer {
    background: #d6eaf8;
    color: #2980b9;
}

.role-member {
    background: #f2f3f4;
    color: #7f8c8d;
}

/* Admin nav */

.admin-nav {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e1e4e8;
    padding-bottom: 0;
}

.admin-nav a {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: #7f8c8d;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-weight: 500;
}

.admin-nav a:hover {
    color: #2c3e50;
}

.admin-nav a.active {
    color: #2c3e50;
    border-bottom-color: #3498db;
}

/* Card header with action button */

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.card-header h2 {
    margin-bottom: 0;
}

/* Buttons */

.btn {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: #2c3e50;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
}

.btn:hover {
    background: #34495e;
    color: white;
}

/* Checkbox row */

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.checkbox-row label {
    margin: 0;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
}

/* Mono textarea */

.mono {
    font-family: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
    font-size: 0.9rem;
}

/* Status badges */

.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-draft {
    background: #f2f3f4;
    color: #7f8c8d;
}

.status-open {
    background: #d4efdf;
    color: #27ae60;
}

.status-sold_out {
    background: #fdebd0;
    color: #e67e22;
}

.status-in_progress {
    background: #d4efdf;
    color: #1e8449;
}

.status-completed {
    background: #f2f3f4;
    color: #566573;
}

.status-canceled {
    background: #fadbd8;
    color: #c0392b;
}

/* Number inputs */

input[type="number"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

input[type="datetime-local"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

input[type="url"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

/* Form sections */

form h2 {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e1e4e8;
}

form h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* Large button */

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
}

/* Link-style button */

.link-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    color: #3498db;
    padding: 0;
}

.link-btn.danger {
    color: #e74c3c;
}

.link-btn:hover {
    text-decoration: underline;
}

/* Collapsible add forms */

.add-form {
    margin-top: 1rem;
    border-top: 1px solid #e1e4e8;
    padding-top: 0.75rem;
}

.add-form summary {
    cursor: pointer;
    color: #3498db;
    font-weight: 500;
}

.add-form form {
    margin-top: 1rem;
}

/* Public events grid */

.events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.event-card {
    display: block;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    color: #333;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.event-card:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.15);
}

.event-card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.event-date {
    font-weight: 700;
    color: #2c3e50;
}

.event-time {
    color: #7f8c8d;
}

.event-card h3 {
    margin-bottom: 0.25rem;
    color: #2c3e50;
}

.event-meta {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.event-price {
    margin-top: 0.5rem;
    font-weight: 600;
    color: #27ae60;
}

/* Event detail page */

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

.event-detail-header h1 {
    margin-bottom: 0;
}

.event-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .event-detail-grid {
        grid-template-columns: 1fr;
    }
}

.event-info dl {
    margin: 0;
}

.event-action {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Registration status badges */

.status-registered {
    background: #d4efdf;
    color: #27ae60;
}

.status-attending {
    background: #d6eaf8;
    color: #2980b9;
}

.status-waitlisted {
    background: #fdebd0;
    color: #e67e22;
}

.status-checked_in {
    background: #d6eaf8;
    color: #2980b9;
}

.status-no_show {
    background: #fadbd8;
    color: #c0392b;
}

/* Players grid */

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.player-card {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: #2c3e50;
    transition: border-color 0.15s;
}

.player-card:hover {
    border-color: #3498db;
}

.player-card {
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
}

.player-username {
    color: #7f8c8d;
    font-size: 0.9rem;
    display: block;
}

/* Avatars */

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

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

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

.avatar-placeholder-sm,
.avatar-placeholder-lg,
.avatar-placeholder-xl {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2c3e50;
    color: white;
    border-radius: 50%;
    text-transform: uppercase;
    font-weight: 700;
    flex-shrink: 0;
}

.avatar-placeholder-sm {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.avatar-placeholder-lg {
    width: 80px;
    height: 80px;
    font-size: 2rem;
}

.avatar-placeholder-xl {
    width: 120px;
    height: 120px;
    font-size: 3rem;
}

.avatar-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-header h1 {
    margin-bottom: 0;
}

input[type="file"] {
    margin-top: 0.25rem;
}

/* Project status page */

.stats-row {
    display: flex;
    gap: 2rem;
    margin: 1.5rem 0;
}

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

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2c3e50;
}

.stat-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-bar-container {
    background: #e1e4e8;
    border-radius: 4px;
    height: 10px;
    margin: 0.75rem 0;
    overflow: hidden;
}

.progress-bar-sm {
    height: 6px;
    margin: 0.5rem 0 1rem;
}

.progress-bar {
    background: #27ae60;
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

/* Interface badges */

.interface-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 500;
}

.interface-active {
    background: #d4efdf;
    color: #27ae60;
}

.interface-minimal {
    background: #fdebd0;
    color: #e67e22;
}

.interface-not_started {
    background: #f2f3f4;
    color: #7f8c8d;
}

/* Feature status badges */

.status-feat-done {
    background: #d4efdf;
    color: #27ae60;
}

.status-feat-in-progress {
    background: #d6eaf8;
    color: #2980b9;
}

.status-feat-todo {
    background: #f2f3f4;
    color: #7f8c8d;
}

/* Round blocks */

.round-block {
    border: 1px solid #e1e4e8;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.round-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-pairing {
    background: #fdebd0;
    color: #e67e22;
}

/* Manage page */

.manage-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.manage-header h1 {
    margin-bottom: 0.25rem;
}

.manage-meta {
    color: #7f8c8d;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.manage-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.helper-text {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.empty-state {
    color: #95a5a6;
    font-style: italic;
    padding: 0.5rem 0;
}

.pairings-table {
    margin-top: 0.5rem;
}

.winner-text {
    color: #27ae60;
}

.pairing-form-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.pairing-form-row > div {
    flex: 1;
    min-width: 140px;
}

.vs-label {
    font-weight: 700;
    color: #7f8c8d;
    padding-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .manage-header {
        flex-direction: column;
        gap: 1rem;
    }
    .pairing-form-row {
        flex-direction: column;
    }
    .vs-label {
        display: none;
    }
}

/* Standings */

.top-standing {
    background: #fefce8;
}

.rank-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
}

.rank-medal.gold {
    background: #f1c40f;
    color: #7d6608;
}

.rank-medal.silver {
    background: #bdc3c7;
    color: #566573;
}

.rank-medal.bronze {
    background: #e67e22;
    color: white;
}

.pairing-player {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: #f2f3f4;
    border-radius: 3px;
    margin: 0.1rem;
    font-size: 0.9rem;
}

/* Docs */

.docs-list {
    list-style: none;
    margin: 0.5rem 0 1.5rem;
}

.docs-list li {
    padding: 0.4rem 0;
    border-bottom: 1px solid #f2f3f4;
}

.docs-list li:last-child {
    border-bottom: none;
}

.doc-content h2 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e1e4e8;
    color: #2c3e50;
}

.doc-content h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.doc-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.doc-content p {
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

.doc-content ul {
    margin: 0.5rem 0 1rem 1.5rem;
}

.doc-content li {
    margin-bottom: 0.35rem;
}

.doc-content pre {
    background: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.doc-content code {
    font-family: "SF Mono", "Menlo", "Monaco", "Courier New", monospace;
    font-size: 0.9em;
}

.doc-content p code {
    background: #f2f3f4;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

.doc-content table {
    margin: 1rem 0;
}

.doc-content strong {
    color: #2c3e50;
}
