/* apply.css - Isolated styles for Application Form */

/* Scope wrapper */
.apply-wrapper {
    /* Background moved to inline style or global utility if needed, but safe here */
    background-color: #fafafa;
}

.apply-container {
    max-width: 960px;
    /* Slightly wider for 3 cards */
    margin: 0 auto;
    padding: 0 1rem;
}

/* Main White Card Frame */
.apply-card-frame {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    /* Premium soft shadow */
    padding: 2rem;
    margin-bottom: 2rem;
    max-width: 900px;
    /* Increased to accommodate 3 columns */
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .apply-card-frame {
        padding: 1.5rem 1rem;
        border-radius: 16px;
    }
}

/* Progress Bar (Refined) */
.step-progress-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    position: relative;
    padding: 0 20px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.step-progress-bar::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 20px;
    right: 20px;
    height: 3px;
    background: #f0f0f0;
    z-index: 0;
    transform: translateY(-50%);
    border-radius: 3px;
}

.progress-line-active {
    position: absolute;
    top: 50%;
    left: 20px;
    height: 3px;
    background: var(--primary-color, #FF7043);
    z-index: 0;
    transform: translateY(-50%);
    width: 0%;
    transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 3px;
}

.step-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #eee;
    color: #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.step-dot.active {
    border-color: var(--primary-color, #FF7043);
    color: var(--primary-color, #FF7043);
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(255, 112, 67, 0.2);
}

.step-dot.completed {
    background: var(--primary-color, #FF7043);
    border-color: var(--primary-color, #FF7043);
    color: #fff;
}

/* Step Headers */
.step-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.step-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.5rem;
}

.step-desc {
    font-size: 0.9rem;
    color: #888;
}

/* Step Content Animation */
.step-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.step-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Plan Cards (Premium Style) */
.plan-selection-container {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.plan-card {
    flex: 1;
    min-width: 250px;
    /* Slightly reduced to fit 3 in row */
    max-width: 320px;
    background: #fff;
    border: 2px solid #eee;
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.plan-card.plan-recommended {
    border-color: var(--primary-color, #FF7043);
    box-shadow: 0 4px 15px rgba(255, 112, 67, 0.1);
}

.plan-card:hover {
    border-color: #ddd;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
}

.plan-card.plan-recommended:hover {
    border-color: var(--primary-color, #FF7043);
    box-shadow: 0 8px 25px rgba(255, 112, 67, 0.2);
}

.plan-card.selected {
    border-color: var(--primary-color, #FF7043);
    background: linear-gradient(to bottom right, #fff, rgba(255, 112, 67, 0.03));
    box-shadow: 0 8px 25px rgba(255, 112, 67, 0.15);
    transform: scale(1.02);
}

/* Selection Indicator */
.plan-check-circle {
    width: 24px;
    height: 24px;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-top: auto;
    /* Push to bottom */
    position: relative;
    transition: all 0.2s;
}

.plan-card.selected .plan-check-circle {
    border-color: var(--primary-color, #FF7043);
    background: var(--primary-color, #FF7043);
}

.plan-card.selected .plan-check-circle::after {
    content: '✓';
    color: #fff;
    font-size: 0.9rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.price-badge {
    background: #333;
    color: #fff;
    font-size: 0.7rem;
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: 0.1em;
}

.price-card .price-name,
.plan-card .price-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #333;
}

.price-card .price-amount,
.plan-card .price-amount {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    color: #333;
    margin-bottom: 1rem;
}

.price-desc,
.plan-card .price-desc {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Form Fields */
.form-group {
    margin-bottom: 1.8rem;
}

.form-label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: #333;
    font-size: 0.95rem;
}

.label-required::after,
.badge-required {
    content: '必須';
    background: #ff5252;
    color: #fff;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
    font-weight: 500;
}

.label-any::after {
    content: '任意';
    background: #eee;
    color: #666;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
    font-weight: 500;
}

.badge-required {
    /* For custom positioning */
    display: inline-block;
    vertical-align: middle;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 1rem 1.2rem;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    background: #fdfdfd;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color, #FF7043);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(255, 112, 67, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 140px;
}

.error-msg {
    color: #d32f2f;
    font-size: 0.85rem;
    margin-top: 0.6rem;
    display: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    background: #ffebeb;
    border-radius: 6px;
    border-left: 3px solid #d32f2f;
}

.form-group.has-error .form-input {
    border-color: #d32f2f;
    background: #fffafa;
}

.form-group.has-error .error-msg {
    display: block;
    /* Ensures visibility */
}

/* Contact Select Box */
.contact-select-box {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #eee;
}

.box-label {
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: block;
}

.contact-split {
    display: flex;
    align-items: center;
    /* Align items vertical center */
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .contact-split {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
}

.contact-split .form-group {
    flex: 1;
    margin-bottom: 0;
}

.contact-separator {
    font-size: 0.85rem;
    color: #999;
    font-weight: 700;
    padding: 0 0.5rem;
    text-align: center;
}

.help-text {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.5rem;
    margin-top: -0.3rem;
}

.center-error {
    text-align: center;
    margin-top: 1rem;
}

/* Summary Cards (Step 4) */
.summary-card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: #fafafa;
    border-radius: 12px;
    padding: 1.2rem;
    border: 1px solid #eee;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.summary-icon {
    font-size: 1.5rem;
    background: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.summary-content {
    flex: 1;
}

.summary-label {
    font-size: 0.8rem;
    color: #888;
    font-weight: 700;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-value {
    font-size: 1rem;
    color: #333;
    font-weight: 500;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    /* Fix: Break long words */
    overflow-wrap: break-word;
    /* Fix: Modern wrap */
}

.summary-value.highlight {
    color: var(--primary-color, #FF7043);
    font-weight: 700;
}

/* Nav Buttons */
.step-nav {
    margin-top: 3rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.center-btn {
    justify-content: center;
}

.split-btn {
    justify-content: space-between;
}

.btn-wide {
    min-width: 200px;
}

.btn-primary {
    /* Extending global btn */
    background: var(--primary-color, #FF7043);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 1rem 2rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 112, 67, 0.3);
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 112, 67, 0.4);
}

.btn-text-only {
    background: transparent;
    border: none;
    color: #888;
    font-weight: 700;
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: color 0.2s;
}

.btn-text-only:hover {
    color: #555;
    text-decoration: underline;
}

.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Plan Card Structure (Desktop Defaults: Card Stack) --- */
.plan-header-grp {
    margin-bottom: 1rem;
}

.plan-body-grp {
    width: 100%;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.plan-row {
    display: block;
}

.p-label {
    display: none;
    /* Desktop: Labels hidden */
}

.p-value {
    display: block;
}

.p-desc-text {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.row-time .p-value {
    font-weight: 700;
    color: #333;
    margin-top: 0.5rem;
}

/* Desktop Order: Content first, then Time */
.row-desc {
    order: 1;
}

.row-time {
    order: 2;
}

.row-time .p-value::before {
    content: '時間：';
    font-weight: 700;
}

/* --- Mobile Responsiveness (Ultra Compressed Table Layout - Ported from Homepage) --- */
@media (max-width: 480px) {
    .apply-container {
        padding: 0 10px;
        /* Precise pixel padding */
    }

    .apply-card-frame {
        padding: 10px 0;
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    /* Compress Header Area */
    h2 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
        padding: 0 10px;
        line-height: 1.2;
    }

    .section-title {
        font-size: 1rem;
        margin-bottom: 0.2rem;
    }

    .section-desc {
        display: none;
        /* Hide description on mobile to save space if needed, or make very small */
    }

    /* Step Progress - Ultra Compact */
    .step-progress-bar {
        padding: 0 10px;
        margin-bottom: 0.8rem;
        transform: scale(0.9);
        /* Shrink entire bar slightly */
        transform-origin: center;
    }

    /* --- Plan Cards: Ported from .mobile-price-item --- */
    .plan-selection-container {
        flex-direction: column;
        gap: 8px;
        /* Tighter gap */
        padding: 0 10px;
        margin-bottom: 1rem;
    }

    .plan-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        text-align: left;
        align-items: stretch;

        /* Ported Styles */
        background: #fff;
        border-radius: 10px;
        border: 1px solid #ddd;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        overflow: hidden;
        padding: 0;
    }

    .plan-card.selected {
        border-color: var(--primary-color, #FF7043);
        background: #fff;
        box-shadow: 0 0 0 2px rgba(255, 112, 67, 0.1);
        z-index: 1;
        /* Bring to front */
    }

    /* Header Row */
    .plan-header-grp {
        background-color: #f9f9f9;
        border-bottom: 1px solid #eee;
        padding: 8px 12px;
        /* Reduced vertical padding */
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0;
        min-height: 40px;
    }

    .price-name {
        font-size: 0.95rem;
        font-weight: 700;
        color: #333;
        margin-bottom: 0;
        line-height: 1.2;
    }

    .price-amount {
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--primary-color, #FF7043);
        font-family: 'Inter', sans-serif;
        margin-bottom: 0;
        line-height: 1;
    }

    .price-badge {
        display: none;
    }

    /* Body Rows */
    .plan-body-grp {
        display: block;
        padding: 8px 12px;
        /* Reduced vertical padding */
        margin-bottom: 0;
        width: auto;
    }

    /* Row */
    .plan-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        /* Align top for multi-line content */
        margin-bottom: 6px;
        padding-bottom: 6px;
        border-bottom: 1px dashed #f0f0f0;
        padding-top: 0;
    }

    .plan-row:last-child {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }

    /* Label */
    .p-label {
        display: block;
        font-size: 0.75rem;
        font-weight: 700;
        color: #888;
        width: 3.5em;
        /* Fixed width for alignment */
        flex-shrink: 0;
        text-align: left;
        margin-right: 0.5rem;
    }

    /* Value */
    .p-value {
        font-size: 0.85rem;
        color: #333;
        text-align: right;
        line-height: 1.4;
        flex: 1;
    }

    .p-desc-text {
        font-size: 0.8rem;
        line-height: 1.3;
    }

    .row-time .p-value::before {
        content: none;
    }

    /* Selection Indicator Bar */
    .plan-check-circle {
        display: none;
    }

    .plan-card.selected::after {
        content: '選択中';
        display: block;
        text-align: center;
        font-size: 0.75rem;
        font-weight: 700;
        color: #fff;
        background: var(--primary-color, #FF7043);
        padding: 2px 0;
        width: 100%;
        line-height: 1.2;
    }

    /* Inputs & Buttons */
    .form-input,
    .form-textarea {
        font-size: 16px;
        /* Prevent zoom */
        padding: 0.6rem 0.8rem;
    }

    .form-group {
        margin-bottom: 1rem;
        /* Reduced */
    }

    .step-nav {
        margin-top: 1rem;
        flex-direction: column-reverse;
        /* Stack buttons vertically */
        gap: 0.8rem;
        padding: 0 10px;
    }

    .step-nav .btn {
        width: 100%;
        margin: 0;
        padding: 0.8rem;
        font-size: 1rem;
    }
}