/* iPhone Mail Config Generator - Frontend CSS (修正版) */

.imc-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.imc-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    color: #721c24;
    display: none;
}

.imc-error-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.imc-error-icon {
    margin-right: 10px;
}

.imc-error-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.imc-usage-status {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    color: #155724;
    display: none;
}

.imc-usage-status.warning {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

.imc-upgrade-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 10px;
}

.imc-form-section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
}

.imc-form-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 18px;
    border-bottom: 2px solid #007cba;
    padding-bottom: 8px;
}

.imc-form-row {
    margin-bottom: 20px;
}

.imc-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.imc-input, .imc-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

.imc-input:focus, .imc-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.imc-input.error, .imc-select.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.imc-radio-group {
    display: flex;
    gap: 20px;
}

.imc-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: all 0.2s ease;
    background: #f8f9fa;
}

.imc-radio-label:hover {
    border-color: #007cba;
    background: #e7f3ff;
}

.imc-radio-label input[type="radio"] {
    width: auto;
    margin: 0;
}

/* チェックボックスグループの強化されたスタイル */
.imc-checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.imc-checkbox-group:hover {
    border-color: #007cba;
    background: #e7f3ff;
}

.imc-checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
    transform: scale(1.1);
}

.imc-checkbox-group input[type="checkbox"]:checked + label,
.imc-checkbox-group:has(input[type="checkbox"]:checked) {
    color: #007cba;
    font-weight: 500;
}

.imc-checkbox-group label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
}

.imc-help {
    display: block;
    margin-top: 5px;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

.imc-form-actions {
    text-align: center;
    margin-top: 30px;
}

.imc-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.imc-btn-primary {
    background: #007cba;
    color: white;
}

.imc-btn-primary:hover:not(:disabled) {
    background: #005a87;
    transform: translateY(-1px);
}

.imc-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.imc-btn-secondary {
    background: #6c757d;
    color: white;
}

.imc-btn-secondary:hover {
    background: #545b62;
    transform: translateY(-1px);
}

.imc-btn-outline {
    background: transparent;
    border: 2px solid #007cba;
    color: #007cba;
}

.imc-btn-outline:hover {
    background: #007cba;
    color: white;
}

.imc-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    display: none;
}

.imc-loading-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.imc-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.imc-result-container {
    margin-top: 30px;
    padding: 30px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    text-align: center;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.imc-result-header {
    margin-bottom: 30px;
}

.imc-result-header h3 {
    color: #28a745;
    margin-bottom: 10px;
    font-size: 24px;
}

.imc-result-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.imc-qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.imc-qr-canvas {
    border: 4px solid #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.imc-qr-actions {
    margin-top: 15px;
}

.imc-config-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.imc-config-section h4 {
    margin-bottom: 15px;
    color: #333;
}

.imc-result-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* フィールドハイライト効果 */
.imc-form-row:hover .imc-input,
.imc-form-row:hover .imc-select {
    border-color: #007cba;
}

/* アクセシビリティ改善 */
.imc-radio-label:focus-within,
.imc-checkbox-group:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .imc-container {
        padding: 10px;
    }
    
    .imc-form-section {
        padding: 15px;
    }
    
    .imc-result-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .imc-radio-group {
        flex-direction: column;
        gap: 10px;
    }
    
    .imc-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .imc-form-section h3 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .imc-form-section {
        margin-bottom: 20px;
        padding: 12px;
    }
    
    .imc-input, .imc-select {
        padding: 10px;
        font-size: 16px; /* iOS対応 */
    }
    
    .imc-checkbox-group,
    .imc-radio-label {
        padding: 10px 12px;
    }
    
    .imc-btn {
        width: 100%;
        padding: 12px 16px;
    }
    
    .imc-result-container {
        padding: 20px;
    }
}

/* ダークモード対応（オプション） */
@media (prefers-color-scheme: dark) {
    .imc-form-section {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .imc-form-section h3 {
        color: #63b3ed;
        border-color: #63b3ed;
    }
    
    .imc-input, .imc-select {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .imc-checkbox-group,
    .imc-radio-label {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
}

/* Stripe決済関連のスタイル追加 */
.imc-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    color: #155724;
}

.imc-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    color: #0c5460;
}

.imc-upgrade-btn {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
    transition: background-color 0.2s ease;
}

.imc-upgrade-btn:hover {
    background: #218838;
}

.imc-upgrade-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.imc-usage-status.warning {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

/* 決済処理中のローディング状態 */
.imc-upgrade-btn.loading {
    background: #6c757d;
    cursor: wait;
}

.imc-upgrade-btn.loading:after {
    content: "...";
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        color: rgba(0,0,0,0);
        text-shadow:
            .25em 0 0 rgba(0,0,0,0),
            .5em 0 0 rgba(0,0,0,0);
    }
    40% {
        color: white;
        text-shadow:
            .25em 0 0 rgba(0,0,0,0),
            .5em 0 0 rgba(0,0,0,0);
    }
    60% {
        text-shadow:
            .25em 0 0 white,
            .5em 0 0 rgba(0,0,0,0);
    }
    80%, 100% {
        text-shadow:
            .25em 0 0 white,
            .5em 0 0 white;
    }
}