.keyword-research-tool {
    max-width: 1000px;
    margin: 0 auto;
    padding: 25px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.keyword-research-tool::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4f46e5, #ec4899, #f59e0b);
    z-index: 1;
}

.krt-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.krt-form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
}

.krt-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.krt-form-group input[type="text"],
.krt-form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.krt-form-group input[type="text"]:focus,
.krt-form-group select:focus {
    border-color: #4f46e5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
    background: #ffffff;
}

#krt-submit {
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    color: white;
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.2);
    align-self: flex-end;
    margin-bottom: 5px;
}

#krt-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(79, 70, 229, 0.25);
}

#krt-submit:active {
    transform: translateY(0);
}

#krt-submit:disabled {
    background: #9ca3af;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

/* Results container */
#krt-results {
    margin-top: 30px;
    padding: 25px;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

#krt-results h3 {
    margin-top: 0;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
    color: #1f2937;
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#krt-results h3:before {
    content: "🔍";
    font-size: 24px;
}

.krt-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 0 0 25px 0;
}

.krt-metric-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04);
    border: 1px solid #f3f4f6;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.krt-metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.07);
}

.krt-metric-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
}
/* Chart container */
#krt-monthly-trends {
    margin: 30px 0;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04);
    border: 1px solid #f3f4f6;
}

#krt-monthly-trends h4 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

#krt-monthly-trends h4:before {
    content: "📈";
}

.krt-chart-container {
    position: relative;
    height: 130px;
    width: 100%;
}

/* Related keywords */
.krt-related-keywords {
    margin: 30px 0 0 0;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04);
    border: 1px solid #f3f4f6;
}

.krt-related-keywords h4 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

.krt-related-keywords h4:before {
    content: "🔗";
}

.krt-related-keywords-container {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.krt-related-table-wrapper {
    flex: 1;
    min-width: 300px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.krt-related-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: white;
}

.krt-related-table th {
    background: #f9fafb;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.krt-related-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f3f4f6;
}

.krt-related-table tr:last-child td {
    border-bottom: none;
}

.krt-related-table tr:hover {
    background: #f9fafb;
}

.krt-clickable-keyword {
    color: #4f46e5;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s ease;
    display: inline-block;
    padding: 2px 0;
    border-bottom: 1px dotted transparent;
}

.krt-clickable-keyword:hover {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}
.krt-metric-label {
    display: block; /* Pushes the value onto the next line */
    margin-bottom: 4px; /* Adds a small space between the label and the value */
}

/* This makes the stat value (e.g., "70.0/100") bold and ensures it's on its own line */
.krt-metric-value {
    display: block;
    font-weight: 700; /* A standard numeric value for bold text */
}
/* Loading animation */
#krt-loading {
    text-align: center;
    padding: 40px 20px;
}

.krt-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(79, 70, 229, 0.2);
    border-radius: 50%;
    border-top-color: #4f46e5;
    animation: krt-spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes krt-spin {
    to { transform: rotate(360deg); }
}

#krt-loading p {
    color: #6b7280;
    font-size: 16px;
    margin: 0;
}

/* Error message */
.krt-error {
    color: #dc2626;
    background-color: #fef2f2;
    padding: 16px 20px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #dc2626;
    display: flex;
    align-items: center;
    gap: 10px;
}

.krt-error:before {
    content: "⚠️";
    font-size: 20px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .keyword-research-tool {
        padding: 20px 15px;
    }
    
    .krt-form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .krt-form-group {
        min-width: 100%;
    }
    
    /* For flexbox version */
    .krt-metrics-grid {
        justify-content: center;
    }
    
    .krt-metric-card {
        min-width: calc(50% - 10px);
        max-width: calc(50% - 10px);
        flex: 0 0 calc(50% - 10px);
    }
    
    /* For grid version - uncomment if using grid */
    /*
    .krt-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    */
    
    .krt-related-table-wrapper {
        min-width: 100%;
    }
    
    #krt-results {
        padding: 20px 15px;
    }
    
    #krt-results h3 {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .krt-metric-card {
        min-width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }
    
    /* For grid version - uncomment if using grid */
    /*
    .krt-metrics-grid {
        grid-template-columns: 1fr;
    }
    */
}
/* Animation for results appearing */
@keyframes krt-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#krt-results {
    animation: krt-fadeIn 0.5s ease forwards;
}

/* Badge for API source */
.krt-api-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #eef2ff;
    color: #4f46e5;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 10px;
    vertical-align: middle;
}
/* Header for data sections to align title and button */
.krt-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.krt-section-header h4 {
    margin: 0; /* Remove default margin from h4 */
}

/* Style for the new export button */
.krt-export-button {
    background-color: #2563eb; /* A professional blue */
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    display: none; /* Hidden by default, shown by JS */
}

.krt-export-button:hover {
    background-color: #1d4ed8;
}