/**
 * KantanPro License Manager Frontend Styles
 *
 * フロントエンド用のスタイル
 *
 * @package KantanPro_License_Manager
 * @since 1.3.0
 */

/* メインコンテナ */
.ktp-license-purchase-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ヘッダー */
.ktp-license-header {
    text-align: center;
    margin-bottom: 40px;
}

.ktp-license-header h2 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
    font-weight: 700;
}

.ktp-license-header p {
    font-size: 1.2rem;
    color: #7f8c8d;
    margin: 0;
}

/* プラン表示 */
.ktp-license-plans {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

.ktp-license-plan {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ktp-license-plan:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: #007cba;
}

.ktp-license-plan.featured {
    border-color: #007cba;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
}

.ktp-license-plan.featured::before {
    content: "おすすめ";
    position: absolute;
    top: 15px;
    right: -30px;
    background: #007cba;
    color: white;
    padding: 5px 40px;
    font-size: 12px;
    font-weight: bold;
    transform: rotate(45deg);
}

/* プランヘッダー */
.plan-header h3 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 600;
}

.plan-price {
    margin-bottom: 20px;
}

.plan-price .price {
    font-size: 2.5rem;
    font-weight: 700;
    color: #007cba;
}

.plan-price .billing-cycle {
    font-size: 1rem;
    color: #7f8c8d;
    margin-left: 5px;
}

/* プラン説明 */
.plan-description {
    color: #5a6c7d;
    line-height: 1.6;
    margin-bottom: 25px;
    font-size: 0.95rem;
}

/* プラン機能 */
.plan-features {
    margin-bottom: 30px;
    text-align: left;
}

.plan-features .feature {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    color: #5a6c7d;
    font-size: 0.9rem;
}

.plan-features .check {
    color: #28a745;
    font-weight: bold;
    margin-right: 10px;
    font-size: 1.1rem;
}

/* 購入ボタン */
.ktp-purchase-btn {
    background: linear-gradient(135deg, #007cba 0%, #005a8b 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ktp-purchase-btn:hover {
    background: linear-gradient(135deg, #005a8b 0%, #004a73 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 124, 186, 0.3);
}

.ktp-purchase-btn:active {
    transform: translateY(0);
}

/* プラン比較表 */
.ktp-plan-comparison {
    margin-top: 50px;
}

.ktp-plan-comparison h3 {
    text-align: center;
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 30px;
}

.comparison-table {
    overflow-x: auto;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.comparison-table th,
.comparison-table td {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
}

.comparison-table th {
    background: #007cba;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.comparison-table th:first-child,
.comparison-table td:first-child {
    text-align: left;
    font-weight: 600;
    background: #f8f9fa;
}

.comparison-table tr:hover {
    background: #f8f9ff;
}

/* モーダル */
.ktp-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.ktp-modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ktp-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s ease;
}

.ktp-modal-close:hover {
    color: #000;
}

.ktp-modal h3 {
    margin-bottom: 25px;
    color: #2c3e50;
    font-size: 1.5rem;
    text-align: center;
}

/* フォーム */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.form-group input[type="email"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input[type="email"]:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

/* Stripe Elements */
#card-element {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    transition: border-color 0.3s ease;
}

#card-element.StripeElement--focus {
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

#card-element.StripeElement--invalid {
    border-color: #dc3545;
}

#card-errors {
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 8px;
    display: none;
}

/* チェックボックス */
.form-group input[type="checkbox"] {
    margin-right: 8px;
}

.form-group label a {
    color: #007cba;
    text-decoration: none;
}

.form-group label a:hover {
    text-decoration: underline;
}

/* 送信ボタン */
#submit-purchase {
    background: linear-gradient(135deg, #007cba 0%, #005a8b 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#submit-purchase:hover:not(:disabled) {
    background: linear-gradient(135deg, #005a8b 0%, #004a73 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 124, 186, 0.3);
}

#submit-purchase:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 成功モーダル */
#ktp-success-modal .ktp-modal-content {
    text-align: center;
}

#success-message {
    color: #28a745;
    font-size: 1.1rem;
    margin-bottom: 25px;
    font-weight: 600;
}

.license-key-display {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.license-key-display h4 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.1rem;
}

#license-key {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    color: #007cba;
    background: white;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
    margin-bottom: 15px;
    word-break: break-all;
}

#copy-license-key {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#copy-license-key:hover {
    background: #218838;
}

#close-success-modal {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#close-success-modal:hover {
    background: #5a6268;
}

/* プラン比較トグルボタン */
.ktp-comparison-toggle {
    background: #007cba;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 20px auto;
    display: block;
}

.ktp-comparison-toggle:hover {
    background: #005a8b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 124, 186, 0.3);
}

/* 購入フォームセクション */
.ktp-purchase-form-section {
    background: #ffffff;
    border: 2px solid #e3f2fd;
    border-radius: 15px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.ktp-purchase-form-container h3 {
    color: #2c3e50;
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
}

.selected-plan-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.plan-details {
    display: flex;
    flex-direction: column;
}

.plan-details span {
    font-weight: 600;
    color: #495057;
}

.plan-details span:first-child {
    font-size: 1.2rem;
    color: #2c3e50;
}

.change-plan-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.change-plan-btn:hover {
    background: #5a6268;
}

/* フォームグループ */
.ktp-form-group {
    margin-bottom: 20px;
}

.ktp-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.ktp-form-group input[type="email"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.ktp-form-group input[type="email"]:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#card-element {
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    transition: border-color 0.3s ease;
}

#card-element:focus-within {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
}

/* 利用規約チェックボックス */
.ktp-form-group input[type="checkbox"] {
    margin-right: 8px;
}

.ktp-form-group label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    font-weight: 400;
}

/* フォームアクション */
.ktp-form-actions {
    text-align: center;
    margin-top: 30px;
}

.ktp-submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ktp-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.ktp-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ktp-processing {
    color: #6c757d;
    font-style: italic;
    margin-top: 10px;
}

/* 成功セクション */
.ktp-success-section {
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
    color: #004d40;
    border-radius: 15px;
    padding: 40px;
    margin: 30px 0;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #4db6ac;
}

.ktp-success-content h3 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #004d40;
}

.ktp-success-content p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.license-info,
.email-info {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    border: 1px solid #80cbc4;
}

.license-info strong,
.email-info strong {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.license-info span,
.email-info span {
    font-size: 1.1rem;
    font-weight: 600;
    word-break: break-all;
}

.success-note {
    font-size: 0.95rem;
    margin-top: 20px;
    opacity: 0.9;
}

/* メッセージエリア */
.ktp-messages {
    margin: 20px 0;
}

.ktp-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 500;
}

.ktp-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.ktp-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .ktp-license-purchase-container {
        padding: 15px;
    }
    
    .ktp-license-header h2 {
        font-size: 2rem;
    }
    
    .ktp-license-header p {
        font-size: 1rem;
    }
    
    .ktp-license-plans {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .ktp-license-plan {
        padding: 20px;
    }
    
    .plan-price .price {
        font-size: 2rem;
    }
    
    .ktp-modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }
    
    .comparison-table {
        font-size: 0.9rem;
    }
    
    .comparison-table th,
    .comparison-table td {
        padding: 10px 8px;
    }

    .selected-plan-info {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .ktp-purchase-form-section,
    .ktp-success-section {
        margin: 20px 0;
        padding: 20px;
    }
    
    .ktp-submit-btn {
        width: 100%;
        padding: 15px 20px;
    }
}

@media (max-width: 480px) {
    .ktp-license-header h2 {
        font-size: 1.8rem;
    }
    
    .plan-price .price {
        font-size: 1.8rem;
    }
    
    .ktp-modal-content {
        margin: 5% auto;
        padding: 15px;
    }
    
    .form-group input[type="email"] {
        padding: 10px 12px;
    }
    
    #submit-purchase {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

/* アニメーション */
.ktp-license-plan {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ローディング状態 */
.ktp-loading {
    position: relative;
    pointer-events: none;
}

.ktp-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
}

.ktp-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1;
}

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

/* アクセシビリティ */
@media (prefers-reduced-motion: reduce) {
    .ktp-license-plan,
    .ktp-modal-content,
    .ktp-purchase-btn,
    .ktp-comparison-toggle {
        animation: none;
        transition: none;
    }
}

/* フォーカス表示 */
.ktp-purchase-btn:focus,
.ktp-modal-close:focus,
#submit-purchase:focus,
#copy-license-key:focus,
#close-success-modal:focus,
.ktp-comparison-toggle:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
    .ktp-license-plan {
        border-width: 3px;
    }
    
    .ktp-purchase-btn,
    #submit-purchase {
        border: 2px solid #000;
    }
} 