/* 公開画面向け追加CSS (templates.phpから移行) */
body {
    font-family: 'Arial', sans-serif;
    background-color: #f8f9fa;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.public-container {
    background-color: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 1200px;
    text-align: center;
    border: 1px solid #e9ecef;
}

/* フォーム専用のスタイリング */
form {
    background-color: #fff !important;
    border-radius: 12px !important;
    padding: 40px !important;
    margin: 20px 0 !important;
    border: 1px solid #e9ecef !important;
    text-align: left !important;
    max-width: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

form h2 {
    text-align: center !important;
    color: #333 !important;
    font-size: 2.4rem !important;
    margin-bottom: 30px !important;
}

.public-header h1 {
    color: #34495e;
    margin-bottom: 30px;
    font-size: 28px;
}

.upload-area {
    border: 3px dashed #a0d3f2;
    border-radius: 10px;
    padding: 50px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
    margin-bottom: 30px;
}

.upload-area:hover,
.upload-area.dragover {
    background-color: #f7faff;
    border-color: #7bbff0;
}

.upload-area p {
    color: #666;
    font-size: 18px;
    margin-bottom: 10px;
}

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

.file-list {
    margin-top: 20px;
    text-align: left;
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.file-list-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.file-list-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    margin-right: 10px;
    border-radius: 3px;
}

.file-info {
    flex-grow: 1;
}

.file-name {
    font-weight: bold;
    color: #333;
}

.file-size {
    font-size: 0.9em;
    color: #777;
}

.file-remove-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 1.2em;
    margin-left: 10px;
}

/* submit-btn の幅調整と位置 */
.submit-btn {
    background-color: #2ecc71;
    color: #fff;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
    margin-top: 20px;
    max-width: 400px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.submit-btn:hover {
    background-color: #27ae60;
}

.response-box {
    background-color: #f0f8ff;
    border: 1px solid #d0e8ff;
    border-radius: 8px;
    padding: 25px;
    text-align: left;
    margin: 30px auto;
    max-width: 900px !important;
    width: 100%;
}

.response-box h2 {
    color: #2c3e50;
    font-size: 24px;
    margin-bottom: 15px;
}

.response-box p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 10px;
}

.response-price {
    font-size: 2.2em;
    color: #e67e22;
    font-weight: bold;
    margin-bottom: 20px;
}

.form-input-group {
    text-align: left;
    margin-bottom: 25px;
}

.form-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
    font-size: 1.5rem;
}

.form-input-group input[type="text"],
.form-input-group input[type="email"],
.form-input-group input[type="tel"],
.form-input-group textarea,
.form-input-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1.6rem;
    font-family: 'Noto Sans JP', sans-serif;
    color: #333;
    line-height: 1.5;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.form-input-group input:focus,
.form-input-group textarea:focus,
.form-input-group select:focus {
    outline: none;
    border-color: #0068C0;
    box-shadow: 0 0 0 2px rgba(0, 104, 192, 0.2);
}

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

.form-input-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23333' d='M9.293 12.95l.707.707 4.243-4.243-1.414-1.414L10 11.586l-2.828-2.829-1.414 1.414L9.293 12.95z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
    padding-right: 40px;
}

/* button-group の調整 */
.button-group {
    margin-top: 30px;
    flex-wrap: nowrap;
}

.button-group .btn {
    display: inline;
    width: 160px;
    padding: 12px 0;
    font-size: 18px;
    border-radius: 6px;
    text-align: center;
}

.back-btn {
    background-color: #95a5a6;
    color: #fff;
    border: 1px solid #95a5a6;
}

.back-btn:hover {
    background-color: #7f8c8d;
    border-color: #7f8c8d;
}

.submit-btn {
    background-color: #0068C0;
    color: #fff;
    border: 1px solid #0068C0;
    padding: 15px 30px;
    font-size: 1.5rem;
    min-width: 200px;
}

.submit-btn:hover {
    background-color: #004d87;
    border-color: #004d87;
}

.back-btn {
    background-color: #95a5a6;
    color: #fff;
    border: 1px solid #95a5a6;
    padding: 8px 16px;
    font-size: 1.2rem;
    min-width: 120px;
}

.back-btn:hover {
    background-color: #7f8c8d;
    border-color: #7f8c8d;
}

.success-message {
    color: #27ae60;
    font-size: 20px;
    font-weight: bold;
    margin-top: 30px;
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-size: 1.5em;
    color: #34495e;
}

.loading-overlay .spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.ai-price-highlight {
    color: #e67e22;
    font-weight: bold;
    font-size: 1.1em;
    display: inline-block;
    text-align: left;
}

.response-box .text-break {
    white-space: normal;
    word-break: break-word;
    text-align: left;
    background-color: #fff;
    padding: 15px;
    box-sizing: border-box;
    margin-bottom: 15px;
}

.response-box li {
    margin: 20px;
}

.response-price {
    font-size: 2.2em;
    color: #e67e22;
    font-weight: bold;
    margin-bottom: 20px;
    text-align: center;
}

.form-select {
    width: calc(100% - 24px);
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
    margin-top: 5px;
    background-color: #fff;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20256%20256%22%3E%3Cpath%20fill%3D%22%23666%22%20d%3D%22M218.106%2099.972l-86.417%2086.417a8%208%200%2001-11.314%200L33.958%2099.972a8%208%200%200111.314-11.314L128%20170.658l73.472-73.472a8%208%200%200111.314%2011.314z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.radio-group label {
    display: flex;
    align-items: center;
    font-weight: normal !important;
    color: #555;
    cursor: pointer;
    font-size: 1.5rem;
    margin-bottom: 0 !important;
}

.radio-group input[type="radio"] {
    margin-right: 8px;
    transform: scale(1.2);
    cursor: pointer;
}

 /* 算出理由のフォントサイズ調整 */
.text-break {
    line-height: 1.4 !important;
    white-space: pre-line !important;
}

.text-break p {
    margin: 0 0 4px 0 !important;
    line-height: 1.4 !important;
    padding: 0 !important;
}

.text-break p:first-child {
    margin-top: 0 !important;
}

.text-break {
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

.text-break > *:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.text-break p:last-child {
    margin-bottom: 0 !important;
}

.text-break ul, .text-break ol {
    margin-bottom: 6px !important;
}

.text-break li {
    margin-bottom: 3px !important;
}

/* アイテム表示用スタイル */
.p-item-breakdown {
    margin-top: 20px;
}

.p-item-breakdown h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 5px;
}

.p-item-list {
    margin-bottom: 20px;
}

.p-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

.p-item-info {
    flex: 1;
}

.p-item-name {
    font-weight: bold;
    color: #333;
    margin-right: 10px;
}

.p-item-quantity {
    color: #666;
    margin-right: 10px;
}

.p-item-note {
    color: #888;
    font-size: 14px;
    font-style: italic;
}

.p-item-price {
    text-align: right;
    min-width: 120px;
}

.p-price {
    font-weight: bold;
    color: #007bff;
    font-size: 16px;
}

.p-error {
    color: #dc3545;
    font-size: 14px;
}

.p-total-section {
    border-top: 2px solid #007bff;
    padding-top: 15px;
    margin-top: 15px;
}

.p-total-price {
    font-size: 20px;
    text-align: center;
    padding: 15px;
    background-color: #e3f2fd;
    border-radius: 8px;
    color: #1976d2;
}

.p-range-note {
    text-align: center;
    margin-top: 10px;
    color: #666;
    font-size: 14px;
}

.p-error-message {
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    margin-top: 10px;
}

/* テーブル用スタイル */
.p-item-table, .p-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.p-item-table th, .p-breakdown-table th,
.p-item-table td, .p-breakdown-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.p-item-table th, .p-breakdown-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #333;
    border-bottom: 2px solid #007bff;
}

.p-item-table tbody tr:hover {
    background-color: #f8f9fa;
}

.p-breakdown-table .text-right {
    text-align: right;
    font-weight: bold;
}

.p-breakdown-table .subtotal-row {
    border-top: 2px solid #007bff;
    background-color: #f0f8ff;
}

.p-breakdown-table .total-row {
    background-color: #e3f2fd;
    font-size: 18px;
    border-top: 3px solid #1976d2;
    border-bottom: 3px solid #1976d2;
}

.p-breakdown-section {
    margin-top: 30px;
}

.p-breakdown-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #007bff;
    padding-bottom: 5px;
}

.p-item-note {
    color: #666;
    font-style: italic;
}

/* VP表示用スタイル */
.vp-info {
    color: #28a745;
    font-size: 14px;
    font-weight: normal;
}

/* 削除ボタン用スタイル */
.item-name-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.delete-item-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    transition: background-color 0.2s;
}

.delete-item-btn:hover {
    background-color: #c82333;
}

.item-row.removing {
    opacity: 0.5;
    transition: opacity 0.3s;
}

/* 階数選択ボタン */
.floor-buttons {
    display: flex;
    gap: 5px;
}

.floor-btn {
    padding: 4px 8px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.floor-btn:hover {
    background: #e9ecef;
}

.floor-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* 親要素の幅制限を上書き */
.l-inner {
    max-width: 1400px !important;
}

/* 処分費用セクション */
.p-price-section {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    max-width: 1200px;
}
.p-price-display {
    font-size: 24px;
    font-weight: bold;
    color: #007bff;
    text-align: center;
    margin: 10px 0;
}

/* 計算中の表示 */
.calculating {
    position: relative;
}

.calculating::after {
    content: '計算中...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: bold;
    color: #007bff;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .public-header img {
        max-width: 100%;
    }

    .public-container {
        max-width: 100% !important;
        padding: 20px;
    }

    .upload-area {
        padding: 30px;
    }

    .btn {
        width: 100% !important;
        max-width: 100% !important;
        padding: 15px 0;
        font-size: 1.2rem;
    }

    .submit-btn {
        width: 100% !important;
        max-width: 100% !important;
    }

    .response-box {
        max-width: 90% !important;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}