/**
 * Keko Wedding RSVP - Minimal Black & White Design
 * Clean, elegant, wedding invitation style
 */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    color: #000;
    background: #fff;
    padding: 20px;
    min-height: 100vh;
}

/* Typography */
h1 {
    font-size: 2rem;
    font-weight: 300;
    margin-bottom: 1.5rem;
    letter-spacing: 0.05em;
}

h2 {
    font-size: 1.5rem;
    font-weight: 400;
    margin: 2rem 0 1rem 0;
    letter-spacing: 0.03em;
}

h3 {
    font-size: 1.25rem;
    font-weight: 400;
    margin: 1.5rem 0 0.75rem 0;
}

p {
    margin-bottom: 1rem;
}

a {
    color: #000;
    text-decoration: underline;
}

a:hover {
    opacity: 0.7;
}

/* Layout */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
}

.container-narrow {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Forms */
form {
    margin: 2rem 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e5e5e5;
    background: #fff;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #000;
}

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

input[type="text"]:disabled,
input[type="text"]:readonly,
input[type="email"]:disabled,
input[type="email"]:readonly,
input[type="password"]:disabled,
input[type="password"]:readonly,
select:disabled,
textarea:disabled,
textarea:readonly {
    background: #fafafa;
    color: #000;
    cursor: not-allowed;
}

input[type="radio"]:disabled,
input[type="checkbox"]:disabled {
    cursor: not-allowed;
}

input[type="radio"]:disabled + label,
input[type="checkbox"]:disabled + label {
    cursor: not-allowed;
    color: #000;
}

/* Card-style radio options for menu selection */
.menu-selector {
    margin: 1rem 0;
}

.menu-selector-collapsed {
    border: 2px solid #e5e5e5;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    position: relative;
}

.menu-selector-collapsed:hover {
    border-color: #999;
}

.menu-selector-collapsed.has-selection {
    border-color: #000;
    background: #fafafa;
    cursor: default;
}

.menu-selector-collapsed.has-selection:hover {
    border-color: #000;
}

.menu-selector-collapsed.disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.menu-selector-placeholder {
    font-size: 1rem;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.menu-selector-placeholder::after {
    content: '▼';
    font-size: 0.75rem;
    color: #999;
}

.menu-selector-collapsed.has-selection .menu-selector-placeholder::after {
    content: '';
}

.menu-selector-selected {
    display: none;
}

.menu-selector-collapsed.has-selection .menu-selector-selected {
    display: block;
}

.menu-selector-collapsed.has-selection .menu-selector-placeholder {
    display: none;
}

.menu-selector-selected-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    letter-spacing: 0.02em;
}

.menu-selector-selected-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

.radio-cards {
    display: none;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.menu-selector.expanded .radio-cards {
    display: grid;
}

.menu-selector.expanded .menu-selector-collapsed {
    display: none;
}

.radio-card {
    position: relative;
    border: 2px solid #e5e5e5;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.radio-card:hover {
    border-color: #999;
}

.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-card.selected {
    border-color: #000;
    background: #fafafa;
}

.radio-card-content {
    display: block;
}

.radio-card-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    letter-spacing: 0.02em;
}

.radio-card-description {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

.radio-card-check {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 24px;
    height: 24px;
    border: 2px solid #000;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.radio-card-check::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #000;
    border-radius: 50%;
}

.radio-card input[type="radio"]:checked ~ .radio-card-check {
    opacity: 1;
}

.radio-card input[type="radio"]:disabled {
    cursor: not-allowed;
}

.radio-card:has(input[type="radio"]:disabled) {
    cursor: not-allowed;
    opacity: 0.8;
}

@media (max-width: 768px) {
    .radio-cards {
        gap: 0.75rem;
    }

    .radio-card,
    .menu-selector-collapsed {
        padding: 1rem;
    }

    .radio-card-title,
    .menu-selector-selected-title {
        font-size: 1rem;
    }

    .radio-card-description,
    .menu-selector-selected-description {
        font-size: 0.85rem;
    }
}

/* Radio buttons and checkboxes */
.radio-group,
.checkbox-group {
    margin: 1rem 0;
}

.radio-option,
.checkbox-option {
    margin-bottom: 0.75rem;
}

input[type="radio"],
input[type="checkbox"] {
    margin-right: 0.5rem;
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

input[type="radio"] + label,
input[type="checkbox"] + label {
    display: inline;
    font-weight: normal;
    cursor: pointer;
    vertical-align: middle;
}

/* Buttons */
button,
.button {
    display: inline-block;
    padding: 12px 32px;
    background: #000;
    color: #fff;
    border: 1px solid #000;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 500;
    letter-spacing: 0.05em;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    min-height: 44px;
    min-width: 44px;
}

button:hover,
.button:hover {
    background: #fff;
    color: #000;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button-secondary {
    background: #fff;
    color: #000;
    border: 1px solid #e5e5e5;
}

.button-secondary:hover {
    border-color: #000;
}

.button-block {
    display: block;
    width: 100%;
    text-align: center;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .button-group {
        flex-direction: column;
    }

    .button-group .button {
        width: 100%;
    }
}

/* Flash messages */
.flash {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e5e5e5;
}

.flash-success {
    background: #f5f5f5;
    border-color: #000;
}

.flash-error {
    background: #f5f5f5;
    border-color: #666;
}

.flash-info {
    background: #fafafa;
}

/* Info boxes */
.info-box {
    padding: 1.5rem;
    border: 1px solid #e5e5e5;
    margin: 1.5rem 0;
}

.info-box-highlight {
    border-color: #000;
    background: #fafafa;
}

/* RSVP Link Display */
.rsvp-link {
    padding: 1.5rem;
    background: #fafafa;
    border: 1px solid #000;
    margin: 2rem 0;
    word-break: break-all;
}

.rsvp-link-url {
    font-family: monospace;
    font-size: 0.9rem;
    display: block;
    margin-top: 0.5rem;
}

/* Status indicators */
.status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    border: 1px solid #e5e5e5;
}

.status-yes {
    border-color: #000;
}

.status-no {
    color: #666;
}

/* Dividers */
hr {
    border: none;
    border-top: 1px solid #e5e5e5;
    margin: 2rem 0;
}

/* Sections */
.section {
    margin: 3rem 0;
}

.section-header {
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Deadline warning */
.deadline-warning {
    padding: 1rem;
    border: 1px solid #000;
    background: #fafafa;
    margin: 1rem 0;
    font-size: 0.9rem;
}

/* Lists */
ul, ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Tables (for admin) */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

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

th {
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

/* Mobile optimization */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container,
    .container-narrow {
        padding: 20px 10px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.35rem;
    }

    button,
    .button {
        padding: 14px 24px;
        width: 100%;
        display: block;
        margin-bottom: 0.5rem;
    }

    /* Stack buttons vertically on mobile */
    .button + .button,
    .button + a.button,
    a.button + .button,
    a.button + a.button {
        margin-left: 0;
    }

    /* Make tables horizontally scrollable */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    /* Adjust table fonts for mobile */
    th, td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    /* Stack form elements */
    .filters {
        flex-direction: column;
    }

    .filters > div {
        width: 100%;
        flex: 1 1 auto !important;
    }

    .filters .button-group {
        width: 100%;
        flex-direction: row;
    }

    .filters .button-group .button {
        flex: 1;
    }

    /* Info boxes */
    .info-box,
    .flash,
    .rsvp-link {
        padding: 1rem;
    }

    /* Reduce margins on mobile */
    .section {
        margin: 2rem 0;
    }

    h2 {
        margin: 1.5rem 0 0.75rem 0;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Hide/show utilities */
.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

.text-small {
    font-size: 0.85rem;
    color: #666;
}

.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* Responsive grid layouts */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

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

    /* Better overflow handling for tables */
    .container {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Improve filter tabs on mobile */
    .filter-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .filter-tab {
        display: inline-block;
    }
}
