:root {
    --bg: #fafaf9;
    --fg: #1c1917;
    --muted: #78716c;
    --border: #d6d3d1;
    --primary: #16a34a;
    --primary-hover: #15803d;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --card-bg: #ffffff;
    --success-bg: #f0fdf4;
    --warning-bg: #fffbeb;
}

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

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

.site-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.site-header a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--fg);
}

.site-header span {
    font-weight: 700;
    font-size: 1.1rem;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
}

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

.description {
    color: var(--muted);
    margin-bottom: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    background: var(--card-bg);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    text-decoration: none;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--fg);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--bg);
    text-decoration: none;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
}
.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-small {
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

/* Hero section */
.hero {
    text-align: center;
    padding: 3rem 0;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    color: var(--muted);
    max-width: 500px;
    margin: 0 auto 2rem;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
    text-align: left;
}

.feature {
    padding: 1rem;
}

.feature h3 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.feature p {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 0;
}

/* Admin link box */
.admin-link-box {
    background: var(--warning-bg);
    border: 1px solid #fbbf24;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.admin-link-box p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.admin-link-box code,
.share-box code {
    display: block;
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    word-break: break-all;
    flex: 1;
}

.copy-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.btn-copy {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--fg);
    white-space: nowrap;
}

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

.share-box {
    background: var(--success-bg);
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.share-box p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Slots input */
.slots-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.slot-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.slot-row input {
    flex: 1;
}

.btn-remove-slot {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.btn-remove-slot:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* Availability grid */
.avail-grid-wrapper {
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.avail-grid {
    border-collapse: collapse;
    width: 100%;
    min-width: 400px;
    background: var(--card-bg);
}

.avail-grid th {
    background: var(--bg);
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    white-space: nowrap;
}

.avail-grid th:first-child {
    text-align: left;
    min-width: 140px;
}

.avail-grid td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    font-size: 0.9rem;
}

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

.avail-grid td:last-child,
.avail-grid th:last-child {
    border-right: none;
}

.avail-grid .name-cell {
    font-weight: 600;
    white-space: nowrap;
}

.avail-grid .name-cell small {
    display: block;
    font-weight: normal;
    color: var(--muted);
    font-size: 0.78rem;
}

.avail-grid td.status-cell {
    text-align: center;
}

.cell-ja {
    background: #dcfce7;
    color: #166534;
    font-weight: 600;
}

.cell-nei {
    background: #fee2e2;
    color: #991b1b;
    font-weight: 600;
}

.cell-kanskje {
    background: #fef9c3;
    color: #854d0e;
    font-weight: 600;
}

.cell-ingen {
    background: var(--bg);
    color: var(--muted);
}

.avail-grid .summary-row td {
    background: var(--bg);
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    color: var(--primary);
    border-top: 2px solid var(--border);
}

.avail-grid .summary-row td:first-child {
    text-align: left;
    color: var(--muted);
    font-weight: 600;
}

.slot-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.btn-delete-slot {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.85rem;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

.btn-delete-slot:hover {
    color: var(--danger);
    background: #fee2e2;
}

/* Response availability form */
.availability-form {
    margin-top: 1.5rem;
}

.slot-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
    flex-wrap: wrap;
}

.slot-item:last-child {
    border-bottom: none;
}

.slot-label {
    flex: 1;
    font-weight: 600;
    min-width: 120px;
}

.status-buttons {
    display: flex;
    gap: 0.4rem;
}

.status-btn {
    padding: 0.4rem 0.9rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
}

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

.status-btn.selected-ja {
    background: #dcfce7;
    border-color: #16a34a;
    color: #166534;
    font-weight: 700;
}

.status-btn.selected-nei {
    background: #fee2e2;
    border-color: #dc2626;
    color: #991b1b;
    font-weight: 700;
}

.status-btn.selected-kanskje {
    background: #fef9c3;
    border-color: #ca8a04;
    color: #854d0e;
    font-weight: 700;
}

/* Success banner */
.success-banner {
    background: var(--success-bg);
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: #166534;
}

/* Status bar */
.status-bar {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.connected {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
}

.disconnected {
    background: var(--danger);
}

/* Add slot form */
.add-slot-form {
    margin-top: 1.5rem;
}

.inline-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.inline-form .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0.5rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--muted);
    font-size: 0.9rem;
}

footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--muted);
    font-size: 0.85rem;
}
