/* KhoDeal SEO Toolkit - Frontend Styles */

.kdseo-container {
    max-width: 900px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.kdseo-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.kdseo-header h2 {
    margin: 0;
    color: #2271b1;
    font-size: 24px;
}

/* Tabs */
.kdseo-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.kdseo-tab-btn {
    flex: 1;
    min-width: 150px;
    padding: 12px 20px;
    background: #f0f0f0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.kdseo-tab-btn:hover {
    background: #e0e0e0;
}

.kdseo-tab-btn.active {
    background: #2271b1;
    color: white;
}

/* API Selector */
.kdseo-api-selector {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 25px;
}

.kdseo-api-selector h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
}

.kdseo-radio-option {
    display: block;
    padding: 12px 15px;
    margin: 10px 0;
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.kdseo-radio-option:hover {
    border-color: #2271b1;
}

.kdseo-radio-option input[type="radio"] {
    margin-right: 10px;
}

.kdseo-radio-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: #2271b1;
}

.kdseo-warning {
    padding: 12px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    margin-bottom: 15px;
}

#user-api-input {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 6px;
}

#user-api-input input {
    width: calc(100% - 140px);
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-right: 10px;
}

.kdseo-help-text {
    margin: 8px 0 0 0;
    color: #666;
}

.kdseo-help-text a {
    color: #2271b1;
    text-decoration: none;
}

.kdseo-help-text a:hover {
    text-decoration: underline;
}

/* Tab Content */
.kdseo-tab-content {
    display: none;
}

.kdseo-tab-content.active {
    display: block;
}

/* Form Section */
.kdseo-form-section {
    padding: 20px;
    background: #fafafa;
    border-radius: 6px;
}

.kdseo-form-section h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #333;
}

.kdseo-form-group {
    margin-bottom: 20px;
}

.kdseo-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.kdseo-form-group input[type="text"],
.kdseo-form-group textarea,
.kdseo-form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

.kdseo-form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Buttons */
.kdseo-btn-primary,
.kdseo-btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.kdseo-btn-primary {
    background: #2271b1;
    color: white;
}

.kdseo-btn-primary:hover {
    background: #135e96;
}

.kdseo-btn-secondary {
    background: #50575e;
    color: white;
}

.kdseo-btn-secondary:hover {
    background: #3c434a;
}

/* Results */
.kdseo-results {
    margin-top: 30px;
    padding: 20px;
    background: #fafafa;
    border-radius: 6px;
}

.kdseo-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.kdseo-results-header h3 {
    margin: 0;
    font-size: 18px;
}

.kdseo-results-stats {
    display: flex;
    gap: 20px;
}

.stat-success {
    color: #46b450;
}

.stat-error {
    color: #dc3232;
}

/* Table */
.kdseo-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.kdseo-results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 6px;
    overflow: hidden;
}

.kdseo-results-table th,
.kdseo-results-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.kdseo-results-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 10;
}

.kdseo-results-table tr:last-child td {
    border-bottom: none;
}

.kdseo-results-table tr:hover {
    background: #f8f9fa;
}

.status-indexed {
    color: #46b450;
    font-weight: 600;
}

.status-not-indexed {
    color: #dc3232;
    font-weight: 600;
}

.rank-number {
    font-weight: 600;
    color: #2271b1;
}

/* Keyword Accordion */
.kdseo-keyword-item {
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background: white;
}

.kdseo-keyword-header {
    padding: 15px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    transition: background 0.3s;
}

.kdseo-keyword-header:hover {
    background: #e9ecef;
}

.kdseo-keyword-header .toggle-icon {
    font-size: 18px;
    transition: transform 0.3s;
}

.kdseo-keyword-header.active .toggle-icon {
    transform: rotate(180deg);
}

.kdseo-keyword-body {
    display: none;
    padding: 20px;
}

.kdseo-keyword-body.active {
    display: block;
}

.kdseo-keyword-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.kdseo-keyword-tab {
    padding: 10px 15px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
}

.kdseo-keyword-tab:hover {
    color: #2271b1;
}

.kdseo-keyword-tab.active {
    color: #2271b1;
    border-bottom-color: #2271b1;
}

.kdseo-tab-pane {
    display: none;
}

.kdseo-tab-pane.active {
    display: block;
}

.kdseo-related-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.kdseo-related-tag {
    padding: 6px 12px;
    background: #e9ecef;
    border-radius: 4px;
    font-size: 13px;
}

/* Loading */
#kdseo-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.kdseo-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2271b1;
    border-radius: 50%;
    animation: kdseo-spin 1s linear infinite;
}

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

#loading-text {
    color: white;
    margin-top: 20px;
    font-size: 16px;
}

/* Validation Result */
#api-validation-result {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

#api-validation-result.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

#api-validation-result.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .kdseo-container {
        padding: 15px;
        margin: 10px;
    }
    
    .kdseo-tabs {
        flex-direction: column;
    }
    
    .kdseo-tab-btn {
        width: 100%;
    }
    
    .kdseo-results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .kdseo-results-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    #user-api-input input {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .kdseo-btn-secondary {
        width: 100%;
    }
    
    .kdseo-results-table {
        font-size: 13px;
    }
    
    .kdseo-results-table th,
    .kdseo-results-table td {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .kdseo-header h2 {
        font-size: 18px;
    }
    
    .kdseo-form-section h3 {
        font-size: 16px;
    }
    
    .kdseo-results-table {
        font-size: 12px;
    }
}