:root {
    --primary-color: #0fa1ba;
    --primary-dark: #0a8094;
    --secondary-color: #f7931e;
    /* Accent color for badges */
    --background-color: #f4f8fb;
    --text-color: #333333;
    --light-text: #666666;
    --white: #ffffff;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    color: var(--text-color);
    background-color: var(--background-color);
    line-height: 1.6;
}

.container {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background-color: var(--white);
    padding: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 40px;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo img {
    height: 40px;
    width: auto;
}

.header h1 {
    font-size: 1.2rem;
    color: var(--primary-color);
    font-weight: 700;
}

/* Main Content */
.main-content {
    margin-bottom: 60px;
}

/* Intro Section */
.intro-section {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--white) 0%, #e6f7fa 100%);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
    gap: 20px;
}

.intro-text {
    flex: 1;
}

.intro-text h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.intro-image {
    width: 150px;
    flex-shrink: 0;
    text-align: center;
}

.intro-image img {
    width: 100%;
    height: auto;
    /* Removed border and radius for character cutout */
}

/* Selection Table Styles */
.form-section-title {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-bottom: 10px;
    text-align: center;
}

.form-description {
    text-align: center;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--light-text);
}

.table-responsive {
    overflow-x: auto;
    margin-bottom: 30px;
    border: 1px solid #eee;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.selection-table {
    width: 100%;
    border-collapse: collapse;
}

.selection-table th,
.selection-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.selection-table th {
    background-color: var(--primary-color);
    color: var(--white);
    font-weight: 700;
    white-space: nowrap;
}

.section-header td {
    background-color: #e6f7fa;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 1rem;
    padding: 12px 15px;
    border-top: 2px solid #cceef5;
}

.part-label {
    display: inline-block;
    background-color: #333;
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
}

.mobile-date {
    display: none;
    font-weight: bold;
    color: var(--primary-color);
    display: none;
    /* Hidden by default on desktop */
}

.selection-table .date {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-color);
}

.selection-table .time {
    font-size: 0.85rem;
    color: var(--light-text);
}

.selection-table .venue-cell {
    vertical-align: middle;
    background-color: #fcfcfc;
}

.target-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    color: white;
    margin-bottom: 6px;
    font-weight: bold;
}

.target-badge.manager {
    background-color: #f7931e;
}

.target-badge.staff {
    background-color: #8bc34a;
}

.selection-table strong {
    display: block;
    font-size: 1.05rem;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.session-desc {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    margin: 0;
}

.check-cell {
    text-align: center !important;
    vertical-align: middle !important;
    width: 80px;
    background-color: #fafafa;
}

.check-cell input[type="checkbox"] {
    width: 25px;
    height: 25px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Form Styles */
.seminar-form {
    background-color: var(--white);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 0.95rem;
}

.badge {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: text-bottom;
}

.badge.required {
    background-color: #ff6b6b;
    color: white;
}

input[type="text"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: box-shadow 0.3s, border-color 0.3s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(15, 161, 186, 0.2);
}

.select-wrapper {
    position: relative;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
}

.checkbox-group input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}

.checkbox-group label {
    margin-bottom: 0;
    font-weight: 400;
}

.checkbox-group a {
    color: var(--primary-color);
    text-decoration: underline;
}

.form-actions {
    margin-top: 40px;
    text-align: center;
}

.submit-btn {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 15px 60px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
    box-shadow: 0 4px 10px rgba(15, 161, 186, 0.3);
}

.submit-btn:hover {
    background-color: var(--primary-dark);
}

.submit-btn:active {
    transform: translateY(2px);
}

.submit-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* Status Message */
.status-message {
    margin-top: 20px;
    text-align: center;
    font-weight: 500;
    min-height: 1.5em;
}

.status-message.success {
    color: #28a745;
}

.status-message.error {
    color: #dc3545;
}

/* Footer */
.footer {
    text-align: center;
    padding: 40px 0;
    color: var(--light-text);
    font-size: 0.85rem;
    background-color: #eef2f5;
    margin-top: 40px;
}

.footer-info {
    margin-bottom: 20px;
    line-height: 1.8;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 0 15px;
    }

    .seminar-form {
        padding: 15px;
    }

    .intro-section {
        flex-direction: column-reverse;
        text-align: center;
    }

    .intro-image {
        margin-bottom: 15px;
        width: 100%;
        /* Full width for illustration */
        max-width: 300px;
        /* Cap width */
    }

    .header-container {
        flex-direction: column;
        gap: 10px;
    }

    /* Mobile Table: Card Style with CSS Grid */
    .table-responsive {
        border: none;
        box-shadow: none;
        overflow: visible;
    }

    .selection-table,
    .selection-table tbody,
    .selection-table tr,
    .selection-table td {
        display: block;
        width: 100%;
        min-width: 0 !important;
    }

    .selection-table thead {
        display: none;
    }

    /* Grid Layout for Row Card */
    .selection-table tr {
        margin-bottom: 20px;
        background-color: #fff;
        border: 1px solid #ddd;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        overflow: hidden;

        /* Switch from Grid to Relative Block for stable absolute positioning */
        display: block;
        position: relative;
        padding-bottom: 5px;

        /* Reset Grid template to avoid conflicts */
        grid-template-columns: none;
        grid-template-rows: none;
    }

    .selection-table tr.section-header {
        display: block;
        /* Header stays block */
        background-color: transparent;
        border: none;
        box-shadow: none;
        margin-bottom: 5px;
        padding-bottom: 0;
    }

    .section-header td {
        display: block;
        background-color: transparent;
        border: none;
        padding: 5px 0 5px 5px;
        color: var(--primary-dark);
        font-size: 1.1rem;
        text-align: left;
        border-top: none;
        white-space: normal;
    }

    /* Cell Reset */
    .selection-table td {
        display: block;
        /* Force block stacking */
        width: 100%;
        padding: 12px 15px;
        border: none;
        text-align: left;
        white-space: normal;
        word-break: break-word;

        /* Padding reset since absolute checkbox is gone */
        padding-right: 15px !important;
        border-bottom: 1px solid #eee;
        /* Restore borders between stacked cells */
    }

    /* Col 1: Date/Time (Grid 1,1) */
    .selection-table td:first-child {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
        border-bottom: 1px solid #eee;
        padding-right: 10px !important;
    }

    /* Checkbox aligned to top-right of its grid cell */
    /* Absolute positioning relative to the 'relative' positioned tr */
    /* Checkbox moved to the bottom of the card */
    .check-cell {
        position: static !important;
        /* Not absolute anymore */
        width: 100% !important;
        height: auto !important;
        padding: 15px !important;
        margin: 0 !important;
        background-color: #f0f8ff !important;
        /* Light highlight for action area */
        border-top: 1px solid #ddd;
        border-bottom: none;
        border-left: none;

        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
    }

    /* Restore label behavior for static layout */
    .check-cell label {
        display: inline-block;
        width: auto;
        height: auto;
        cursor: pointer;
        position: static;
        font-weight: bold;
        color: var(--primary-color);
        pointer-events: auto;
    }

    /* Inject text "参加する" via CSS for mobile only */
    .check-cell label::after {
        content: "参加する";
        margin-left: 8px;
        color: var(--primary-dark);
    }

    /* Standard Native Checkbox */
    .check-cell input[type="checkbox"] {
        position: static;
        opacity: 1;
        width: 24px;
        height: 24px;
        cursor: pointer;
        margin: 0;
        transform: scale(1.3);
        accent-color: var(--primary-color);
    }

    /* Remove pseudo-elements */
    .check-cell input[type="checkbox"]:checked+label {
        background: none;
        box-shadow: none;
    }

    .check-cell input[type="checkbox"]:checked+label::after {
        content: none;
    }

    .mobile-date {
        display: block;
        margin-bottom: 5px;
    }
}

/* Confirmation Modal (Global) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.confirmation-details {
    margin-bottom: 30px;
    text-align: left;
}

.confirm-row {
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}

.confirm-label {
    font-weight: bold;
    color: #666;
    display: block;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.confirm-value {
    font-size: 1rem;
    color: #333;
    white-space: pre-wrap;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    transition: opacity 0.2s;
}

.modal-btn.back {
    background-color: #ccc;
    color: #333;
}

.modal-btn.send {
    background-color: var(--primary-color);
    color: #fff;
}

.modal-btn.send:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.modal-btn:hover {
    opacity: 0.9;
}

/* Support line breaks in status message */
.status-message {
    margin-top: 20px;
    text-align: center;
    font-weight: 500;
    min-height: 1.5em;
    white-space: pre-wrap;
    /* Allows \n to break lines */
    line-height: 1.8;
}