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

:root {
    --bg: #fafafa;
    --card: #ffffff;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 12px;
}

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

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 100px;
}

.header {
    text-align: center;
    padding: 24px 0;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* Card */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 16px;
}

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

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

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s;
}

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

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

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

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.85rem;
    min-height: 36px;
    width: auto;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    min-height: auto;
}

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

.btn-danger {
    color: var(--danger);
}

/* Image upload */
.image-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
}

.image-upload:hover {
    border-color: var(--primary);
    background: #f0f7ff;
}

.image-upload.has-image {
    padding: 0;
    border: none;
}

.image-upload img {
    width: 100%;
    border-radius: var(--radius);
    display: block;
}

.image-upload-placeholder {
    color: var(--text-muted);
}

.image-upload input[type="file"] {
    display: none;
}

/* Date groups for create form */
.date-group {
    background: var(--bg);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.date-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.date-group-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.time-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card);
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
}

.time-slot input[type="time"] {
    border: none;
    font-size: 1rem;
    background: transparent;
    flex: 1;
    font-family: inherit;
}

.time-slot input[type="time"]:focus {
    outline: none;
}

.add-time-btn {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

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

.add-date-btn {
    width: 100%;
    padding: 14px;
    background: var(--card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
    font-family: inherit;
}

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

/* RSVP page */
.event-header {
    text-align: center;
    margin-bottom: 24px;
}

.event-image {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.event-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.event-description {
    color: var(--text-muted);
}

/* Availability grid */
.availability-grid {
    overflow-x: auto;
    margin: 0 -20px;
    padding: 0 20px;
}

.availability-table {
    width: 100%;
    min-width: 300px;
    border-collapse: collapse;
}

.availability-table th {
    padding: 8px 4px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
}

.availability-table td {
    padding: 4px;
    text-align: center;
}

.availability-table .name-cell {
    text-align: left;
    font-weight: 500;
    font-size: 0.9rem;
    padding-right: 12px;
    white-space: nowrap;
}

.avail-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--card);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 1rem;
}

.avail-btn:active {
    transform: scale(0.95);
}

.avail-btn.yes {
    background: #d1fae5;
    border-color: var(--success);
    color: var(--success);
}

.avail-btn.maybe {
    background: #fef3c7;
    border-color: var(--warning);
    color: var(--warning);
}

.avail-btn.no {
    background: #fee2e2;
    border-color: var(--danger);
    color: var(--danger);
}

/* Response indicators for display only */
.response-indicator {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    margin: 0 auto;
}

.response-indicator.yes {
    background: #d1fae5;
    color: var(--success);
}

.response-indicator.maybe {
    background: #fef3c7;
    color: var(--warning);
}

.response-indicator.no {
    background: #fee2e2;
    color: var(--danger);
}

/* Login page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.login-card {
    width: 100%;
}

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

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* Admin banner */
.admin-banner {
    background: #1f2937;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    margin-bottom: 16px;
}

/* Pick time cards */
.pick-time-card {
    cursor: pointer;
    transition: all 0.2s;
    padding: 16px;
}

.pick-time-card:hover {
    border-color: var(--primary);
}

.pick-time-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pick-time-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.summary-count {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    background: var(--bg);
    flex-shrink: 0;
}

.summary-count.best {
    background: #d1fae5;
    color: var(--success);
}

.summary-date {
    flex: 1;
}

.summary-date strong {
    display: block;
    font-size: 0.95rem;
}

.summary-date span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Share section */
.share-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.share-link-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.share-link-text {
    flex: 1;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Confirmed banner */
.confirmed-banner {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid var(--success);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.confirmed-icon {
    width: 48px;
    height: 48px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    flex-shrink: 0;
}

.confirmed-details {
    display: flex;
    flex-direction: column;
}

.confirmed-label {
    font-size: 0.85rem;
    color: #065f46;
    font-weight: 500;
}

.confirmed-time {
    font-size: 1.1rem;
    color: #065f46;
    font-weight: 600;
}

/* Attendee list */
.attendee-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.attendee-row:last-child {
    border-bottom: none;
}

.attendee-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 500;
}

.attendee-avatar.yes {
    background: #d1fae5;
    color: var(--success);
}

.attendee-avatar.maybe {
    background: #fef3c7;
    color: var(--warning);
}

.attendee-avatar.no {
    background: #fee2e2;
    color: var(--danger);
}

.attendee-name {
    flex: 1;
    font-weight: 500;
}

.attendee-status {
    font-size: 0.85rem;
    font-weight: 500;
}

.attendee-status.yes {
    color: var(--success);
}

.attendee-status.maybe {
    color: var(--warning);
}

.attendee-status.no {
    color: var(--danger);
}

/* RSVP buttons for confirmed page */
.rsvp-buttons {
    display: flex;
    gap: 12px;
}

.rsvp-btn {
    flex: 1;
    padding: 14px;
}

.rsvp-btn.going {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid var(--success);
}

.rsvp-btn.going:hover {
    background: #a7f3d0;
}

.rsvp-btn.not-going {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid var(--danger);
}

.rsvp-btn.not-going:hover {
    background: #fecaca;
}

/* Date picker modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
}

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

.modal {
    background: var(--card);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h3 {
    margin-bottom: 16px;
}

.modal input[type="date"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 16px;
    font-family: inherit;
}

/* Utility classes */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mt-2 {
    margin-top: 16px;
}

.mb-2 {
    margin-bottom: 16px;
}

/* Section headers */
.section-header {
    font-size: 1rem;
    margin: 20px 0 12px;
}

/* Error pages */
.error-container {
    text-align: center;
    padding: 3rem 1rem;
}

.error-container h1 {
    font-size: 4rem;
    color: var(--text-muted);
    margin: 0;
}

.error-title {
    font-size: 1.5rem;
    font-weight: 500;
    margin: 0.5rem 0;
}

.error-message {
    color: var(--text-muted);
    margin: 0 0 2rem;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1f2937;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 12px;
        padding-bottom: 80px;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .event-title {
        font-size: 1.25rem;
    }

    .avail-btn {
        width: 36px;
        height: 36px;
    }

    .response-indicator {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }

    .error-container h1 {
        font-size: 3rem;
    }
}
