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

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

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 2px solid #2563eb;
    margin-bottom: 20px;
}

header h1 {
    font-size: 1.5rem;
    color: #1e40af;
}

nav a {
    margin-left: 16px;
    color: #2563eb;
    text-decoration: none;
}

nav a:hover {
    text-decoration: underline;
}

.memo {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* Forms */
.login-form {
    max-width: 400px;
    margin: 60px auto;
    background: white;
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.login-form h2 {
    margin-bottom: 24px;
    text-align: center;
}

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

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

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-success {
    background: #16a34a;
    color: white;
}

.btn-success:hover {
    background: #15803d;
}

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

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

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

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

.btn-icon {
    padding: 4px 10px;
    font-size: 1.1rem;
    line-height: 1;
}

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

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-default {
    background: #f3f4f6;
    color: #6b7280;
}

/* Brain ring checkbox */
.brain-ring-section {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.brain-ring-section label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
}

.brain-ring-section input[type="checkbox"] {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    cursor: pointer;
}

/* Games list */
.games-list {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.games-list h3 {
    margin-bottom: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}

th {
    font-weight: 600;
    color: #6b7280;
    font-size: 0.85rem;
    text-transform: uppercase;
}

/* Team info */
.team-info-section {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.team-info-form .form-group {
    margin-bottom: 0;
}

.team-info-form input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
}

.team-info-form input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.team-info-form input:disabled {
    background: #f3f4f6;
    color: #6b7280;
}

/* Lineup editor */
.lineup-page h2 {
    margin-bottom: 8px;
}

.hint {
    color: #6b7280;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.editor-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.panel {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.panel h3 {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

.lineup-panel h3 {
    border-bottom-color: #2563eb;
}

.candidates-panel h3 {
    border-bottom-color: #16a34a;
}

.player-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 4px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.player-card:hover {
    background: #f3f4f6;
}

.player-info {
    font-size: 0.9rem;
}

.empty {
    color: #9ca3af;
    font-style: italic;
    padding: 20px 0;
    text-align: center;
}

.add-by-id {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.add-by-id h4 {
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #6b7280;
}

.add-by-id input {
    width: 100%;
    margin-bottom: 4px;
}

/* Search results */
#search-results {
    margin-top: 4px;
}

.search-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    margin-bottom: 2px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.search-result:hover {
    background: #dcfce7;
}

/* Town autocomplete */
.autocomplete-wrap {
    position: relative;
}

#town-results {
    position: absolute;
    z-index: 10;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: 100%;
    margin-top: 2px;
}

.town-result {
    padding: 8px 12px;
    border: none;
    border-bottom: 1px solid #f3f4f6;
}

.town-result:last-child {
    border-bottom: none;
}

.search-empty {
    color: #9ca3af;
    font-size: 0.85rem;
    font-style: italic;
    padding: 4px 0;
}

.input-small {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    width: 120px;
}

.input-small:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Lineup actions */
.lineup-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.submitted-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Error */
.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* HTMX loading indicator */
.htmx-request .btn {
    opacity: 0.6;
    pointer-events: none;
}

/* Request form */
.request-page {
    max-width: 600px;
    margin: 0 auto;
}

.request-page h2 {
    margin-bottom: 16px;
}

.request-form {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.request-form select,
.request-form input[type="number"],
.request-form input[type="text"],
.request-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}

.request-form select:focus,
.request-form input:focus,
.request-form textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.request-form textarea {
    resize: vertical;
}

.request-form .btn {
    margin-right: 8px;
}

.success-message {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 768px) {
    .editor-panels {
        grid-template-columns: 1fr;
    }
}
