/**
 * フロントエンド用スタイル（統一版）
 * すべてのフォーム種別で共通のデザインシステムを使用
 */

.cim-form-wrapper {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
}

/* ============================================
   プログレスバー（統一デザイン）
   ============================================ */
.cim-progress-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    padding: 0;
    counter-reset: step;
}

.cim-progress-step {
    flex: 1;
    text-align: center;
    position: relative;
    color: #999;
    font-weight: bold;
}

.cim-progress-step::before {
    content: counter(step);
    counter-increment: step;
    width: 40px;
    height: 40px;
    line-height: 40px;
    border: 3px solid #ddd;
    display: block;
    margin: 0 auto 10px auto;
    border-radius: 50%;
    background-color: white;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.cim-progress-step::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 3px;
    background-color: #ddd;
    top: 20px;
    left: -50%;
    z-index: -1;
    transition: all 0.3s ease;
}

.cim-progress-step:first-child::after {
    content: none;
}

.cim-progress-step.active {
    color: #0070BD;
}

.cim-progress-step.active::before {
    border-color: #0070BD;
    background-color: #0070BD;
    color: #fff;
    transform: scale(1.1);
}

.cim-progress-step.active::after {
    background-color: #0070BD;
}

.cim-progress-step.completed {
    color: #46b450;
}

.cim-progress-step.completed::before {
    border-color: #46b450;
    background-color: #46b450;
    color: #fff;
    content: "✓";
}

.cim-progress-step.completed::after {
    background-color: #46b450;
}

.cim-step-label {
    display: block;
    font-size: 14px;
    margin-top: 5px;
}

/* フォーム */
.cim-form {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    position: relative;
}

#cim-form-table table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

#cim-form-table th,
#cim-form-table td {
    padding: 20px;
    border: 1px solid #e8e8e8;
    vertical-align: middle;
}

#cim-form-table th {
    background: #f9f9f9;
    width: 25%;
    font-weight: bold;
    text-align: left;
}

.cim-input,
.cim-textarea,
.cim-select,
.cim-input-date {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.cim-input:focus,
.cim-textarea:focus,
.cim-select:focus,
.cim-input-date:focus {
    border-color: #0073aa;
    outline: none;
}

.cim-textarea {
    resize: vertical;
    min-height: 120px;
}

.cim-required {
    background-color: #d9534f;
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: normal;
    margin-left: 8px;
    display: inline-block;
}

.cim-optional {
    background-color: #999;
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: normal;
    margin-left: 8px;
    display: inline-block;
}

/* ボタン */
.cim-button {
    padding: 12px 30px;
    border: none;
    background: #f0f0f0;
    color: #333;
    font-size: 16px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.cim-button:hover {
    background: #e0e0e0;
}

.cim-button-primary {
    background: #0073aa;
    color: #fff;
    border: none;
}

.cim-button-primary:hover {
    background: #005a87;
}

.cim-form-actions {
    margin-top: 30px;
    text-align: center; /* ボタンを中央揃え */
}

.cim-form-actions .cim-button {
    margin: 0 10px;
}

.cim-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cim-loading-container {
    text-align: center;
}

.cim-loading-message {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin-top: 20px;
    letter-spacing: 1px;
}

.loader {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
}

.loading-text {
    color: white;
    font-size: 14pt;
    font-weight: 600;
    margin-left: 10px;
}

.dot {
    margin-left: 3px;
    animation: blink 1.5s infinite;
}

.dot:nth-child(2) {
    animation-delay: 0.3s;
}

.dot:nth-child(3) {
    animation-delay: 0.6s;
}

.loading-bar-background {
    --height: 30px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding: 5px;
    width: 200px;
    height: var(--height);
    background-color: #212121;
    box-shadow: #0c0c0c -2px 2px 4px 0px inset;
    border-radius: calc(var(--height) / 2);
}

.loading-bar {
    position: relative;
    display: flex;
    justify-content: center;
    flex-direction: column;
    --height: 20px;
    width: 0%;
    height: var(--height);
    overflow: hidden;
    background: linear-gradient(0deg, rgba(222, 74, 15, 1) 0%, rgba(249, 199, 79, 1) 100%);
    border-radius: calc(var(--height) / 2);
    animation: loading 3s ease-out forwards;
}

.white-bars-container {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 18px;
}

.white-bar {
    background: linear-gradient(-45deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 70%);
    width: 10px;
    height: 45px;
    opacity: 0.3;
    rotate: 45deg;
}

@keyframes loading {
    0% {
        width: 0;
    }
    90% {
        width: 100%;
    }
    100% {
        width: 100%;
    }
}

@keyframes blink {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

/* ============================================
   確認画面メッセージ（統一デザイン）
   ============================================ */
.cim-confirm-message {
    padding: 20px;
    margin: 20px 0;
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    border-left: 5px solid #0070BD;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.8;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 112, 189, 0.1);
}

.cim-confirm-message p {
    margin: 0;
}

/* メッセージ */
.cim-message {
    padding: 15px;
    margin: 20px 0;
    border-radius: 8px;
    border-left: 5px solid;
}

.cim-message-success {
    background: linear-gradient(135deg, #d7f8d8 0%, #c8f0ca 100%);
    border-left-color: #46b450;
    color: #2e7d32;
}

.cim-message-error {
    background: linear-gradient(135deg, #fdd 0%, #fcc 100%);
    border-left-color: #d00;
    color: #c00;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .cim-form-wrapper {
        padding: 15px;
        margin: 10px auto;
    }

    #cim-form-table th,
    #cim-form-table td {
        display: block;
        width: 100%;
        text-align: left; /* ラベルと入力欄を左揃えに */
    }

    #cim-form-table th {
        border-bottom: none;
        padding-bottom: 8px;
        background: none; /* 背景色をなくす */
    }

    #cim-form-table td {
        border-top: none;
        padding-top: 0;
        padding-bottom: 20px; /* 各入力欄の下にスペースを確保 */
    }

    .cim-progress-bar {
        padding: 0;
        margin-bottom: 30px;
    }

    .cim-step-label {
        font-size: 12px;
    }

    .cim-form-actions .cim-button {
        width: 100%;
        margin: 10px 0; /* ボタンを縦に並べる */
        display: block;
    }
}
