/* Main SEO Score Box Styles */
.aysa-metabox-container {
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* Unified shell used across product/page/category/post metaboxes */
.aysa-metabox-unified {
    border: 1px solid #d7e4f8;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(21, 54, 100, 0.08);
}

.aysa-metabox-unified .aysa-metabox-header {
    margin: 0 0 16px;
}

.aysa-metabox-unified .aysa-metabox-content {
    padding: 0 12px 12px;
}

.aysa-metabox-unified .aysa-metabox-brand h2 {
    margin: 0;
}

.aysa-metabox-unified .aysa-metabox-subtitle {
    margin: 4px 0 0;
    color: #4a5a70;
    font-size: 13px;
}

.aysa-metabox-unified .aysa-blog-section {
    border: 1px solid #dce8fb;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.aysa-metabox-unified .aysa-step {
    border: 1px solid #dbe7fa;
}

.aysa-metabox-unified .aysa-button-group .aysa-generate-btn,
.aysa-metabox-unified .aysa-button.aysa-button-primary {
    border-radius: 8px;
    font-weight: 600;
}

/* Distinctive AYSA frame in WP editor */
#aysa_product_seo.postbox,
#custom_product_meta_box.postbox {
    border: 1px solid #c8dbf5;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(21, 54, 100, 0.08);
    overflow: hidden;
}

#aysa_product_seo .postbox-header,
#custom_product_meta_box .postbox-header {
    background: linear-gradient(135deg, #f6f9ff 0%, #eef5ff 100%);
    border-bottom: 1px solid #d8e6fb;
}

#aysa_product_seo .hndle,
#custom_product_meta_box .hndle {
    color: #153664;
    font-weight: 700;
}

.aysa-metabox-header {
    position: relative;
    margin-bottom: 16px;
    padding: 14px 16px 12px;
    border: 1px solid #dce8fb;
    border-radius: 12px;
    background: radial-gradient(circle at top right, rgba(53, 122, 226, 0.16), transparent 42%), #f9fbff;
}

.aysa-metabox-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.aysa-metabox-brand h2 {
    margin: 0;
    color: #123461;
    font-size: 18px;
    letter-spacing: 0.1px;
}

.aysa-metabox-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 999px;
    background: linear-gradient(135deg, #1f72d8, #3ca5ff);
    color: #fff;
}

.aysa-metabox-credits {
    display: inline-flex;
    align-items: center;
    margin-top: 0;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #d4e5ff;
    background: #fff;
}

.seo-score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0 0;
    max-width: 100%;
    overflow: hidden;
}

.seo-score-box.aysa-score-hero {
    align-items: stretch;
    margin: 12px 0 14px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #c5dcfa;
    background: linear-gradient(130deg, #0f3f7d 0%, #1967c7 52%, #2f8ff2 100%);
    color: #fff;
    box-shadow: 0 14px 24px rgba(16, 53, 101, 0.2);
}

.aysa-score-hero-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.aysa-score-main,
.aysa-score-grade-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.aysa-score-main-value {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.4px;
}

.aysa-score-main-label {
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0.92;
}

.aysa-score-divider {
    width: 1px;
    height: 42px;
    background: rgba(255, 255, 255, 0.38);
}

.aysa-score-grade-value {
    font-size: 19px;
    font-weight: 700;
}

.aysa-score-grade-label {
    margin-top: 5px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.45px;
    opacity: 0.9;
}

.seo-score-box.aysa-score-hero .progress-bar-container {
    width: 100%;
    height: 8px;
    margin-top: 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.24);
    overflow: hidden;
}

.seo-score-box.aysa-score-hero .progress-bar-container .progress-bar {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #d7e8ff 0%, #ffffff 52%, #d7e8ff 100%);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.45);
    transition: width 0.45s ease;
}

.aysa-score-tab-current {
    text-align: center;
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid #d9e6fb;
    border-left: 4px solid #1f72d8;
    background: linear-gradient(180deg, #fbfdff 0%, #f4f8ff 100%);
}

.aysa-score-tab-current-label {
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #4a5a70;
}

.aysa-score-tab-current-value {
    font-size: 25px;
    font-weight: 700;
    color: #143457;
}

.aysa-score-tab-max {
    margin-left: 2px;
    font-size: 17px;
    color: #5f6e85;
}

.seo-score-box h3 {
    margin: 0 0 10px 0;
    text-align: center;
    width: 100%;
}

.seo-score-box .score-text {
    color: #008392;
}

.seo-score-box .score-value {
    color: #008392;
    font-weight: 600;
}

.seo-score-box .score-total {
    color: #666;
    font-weight: normal;
}

.seo-score-container {
    display: none !important;
}

#aysaSeoRadarChart {
    width: 320px !important;
    height: 320px !important;
    display: block;
    max-width: 100%;
}

/* ❌ HIDE metric pills - readability, originality, SEO, tone */
.metric-pill,
.metric-readability,
.metric-seo,
.metric-originality,
.metric-tone {
    display: none !important;
}

/* Also hide them in sidebar */
#side-sortables .metric-pill,
#side-sortables .metric-readability,
#side-sortables .metric-seo,
#side-sortables .metric-originality,
#side-sortables .metric-tone {
    display: none !important;
}

/* ❌ HIDE Target label below score */
#center-label {
    display: none !important;
}

/* ✅ All metric pill styles removed - they are hidden */

/* Make chart smaller in sidebar */
#side-sortables #aysaSeoRadarChart {
    width: 280px !important;
    height: 280px !important;
}

#side-sortables .seo-score-container {
    display: none !important;
}

#center-label {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #666;
}

/* Edit Snippet button styles */
.edit-snippet {
    background-color: #0073aa !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 8px 16px !important;
    cursor: pointer !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 100px !important;
    height: 36px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    text-decoration: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

.edit-snippet:hover {
    background-color: #006291 !important;
    color: white !important;
}

.edit-snippet:disabled {
    background-color: #ccc !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}

.edit-snippet:focus {
    outline: none !important;
    box-shadow: 0 0 0 1px #fff, 0 0 0 3px #0073aa !important;
}

.edit-snippet.success {
    background-color: #46b450 !important;
}

.edit-snippet.error {
    background-color: #dc3232 !important;
}

/* Responsive styles for sidebar */
#side-sortables .inner-box {
    padding: 0;
    margin-bottom: 10px;
}

#side-sortables .tab-container {
    display: flex;
    flex-direction: column;
}

#side-sortables .btn.btn-universal {
    margin-top: 5px;
}

#side-sortables .sub-group {
    margin-bottom: 10px;
}

#side-sortables textarea {
    min-height: 80px;
}

#side-sortables .progress-container {
    margin-top: 5px;
}

/* Improve button layout in sidebar */
#side-sortables .edit-snippet {
    margin-top: 5px;
    width: 100%;
}

#side-sortables #generate-suggestions-btn {
    width: 100%;
    transition: all 0.3s ease;
    border: 2px solid #c3c4c7;
}

/* ✅ Enhanced visual feedback for Generate SEO Suggestions button */
#generate-suggestions-btn {
    transition: all 0.3s ease;
    border: 2px solid #c3c4c7;
    background: #2ea043 !important;
    color: white !important;
}

/* Override WordPress button-primary styles for Generate SEO buttons */
.button-primary[id*="generate"], 
.button-primary.aysa-sidebar-generate-btn,
button[id*="generate-suggestions"],
#aysa-floating-seo-button,
.wp-core-ui .button-primary[id*="generate"],
.wp-core-ui button[id*="generate-suggestions"] {
    background: #2ea043 !important;
    border-color: #2ea043 !important;
    color: white !important;
    background-image: none !important;
    text-shadow: none !important;
}

.button-primary[id*="generate"]:hover, 
.button-primary.aysa-sidebar-generate-btn:hover,
button[id*="generate-suggestions"]:hover,
#aysa-floating-seo-button:hover,
.wp-core-ui .button-primary[id*="generate"]:hover,
.wp-core-ui button[id*="generate-suggestions"]:hover {
    background: #238636 !important;
    border-color: #238636 !important;
    color: white !important;
    background-image: none !important;
    text-shadow: none !important;
}

#generate-suggestions-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(46, 160, 67, 0.3) !important;
}

#generate-suggestions-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 160, 67, 0.2);
}

#generate-suggestions-btn.keyword-ready {
    border-color: #2ea043;
    box-shadow: 0 2px 4px rgba(46, 160, 67, 0.2);
}

#generate-suggestions-btn.keyword-ready:hover {
    border-color: #238636;
    box-shadow: 0 4px 8px rgba(46, 160, 67, 0.4);
}

/* Visual feedback for keyword input */
#aysa-entity-keyword {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#aysa-entity-keyword:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
}

#aysa-entity-keyword.has-value {
    border-color: #00a32a;
    box-shadow: 0 0 0 1px rgba(0, 163, 42, 0.1);
}

/* Make category metabox more compact overall */
.keyword-column input,
.keyword-column textarea {
    width: 100%;
}

@media (max-width: 782px) {
    .aysa-metabox-brand {
        flex-wrap: wrap;
    }

    .seo-score-box.aysa-score-hero {
        padding: 14px 12px;
    }

    .aysa-score-main-value {
        font-size: 30px;
    }

    .keyword-row {
        flex-direction: column;
    }
    
    .keyword-column {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .keyword-button {
        align-self: flex-start;
    }
    
    /* Make chart smaller on mobile */
    #aysaSeoRadarChart {
        width: 250px !important;
        height: 250px !important;
    }
    
    .seo-score-container {
        max-width: 270px;
        margin: 15px auto 40px auto;
        padding-top: 20px;
        padding-bottom: 15px;
    }
    
    /* ✅ Metric pills removed from mobile view too */
}

/* Update panel styles - Remove borders and reduce padding */
.panel {
    display: none;
    padding: 15px 0;
    margin-top: 5px;
}

.panel.active {
    display: block;
}

/* Sidebar panels don't need borders */
#side-sortables .panel {
    padding: 5px 0;
    margin-top: 0;
}

/* Ensure proper tab styling */
.tabs {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
    border-bottom: 1px solid #ddd;
}

.tabs li {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s ease;
}

.tabs li.active {
    border-bottom-color: #2271b1;
    color: #2271b1;
    font-weight: 500;
}

.tabs li:hover {
    border-bottom-color: #c3c4c7;
    color: #2271b1;
}

/* Make tabs compact in sidebar */
#side-sortables .tabs {
    margin: 0 0 10px 0;
}

#side-sortables .tabs li {
    padding: 6px 8px;
    font-size: 12px;
}

/* Inner box styles */
.inner-box {
    margin-bottom: 15px;
}

/* Text box with button should have proper spacing */
.text-box button {
    margin-top: 10px !important;
    margin-bottom: 5px !important;
}

/* Text box specific styles */
.text-box {
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 4px;
    background: #fafafa;
    margin-bottom: 15px;
}

/* Remove border for sidebar text boxes */
#side-sortables .text-box {
    border: none;
    padding: 0;
    background: transparent;
    text-align: center;
    margin-bottom: 10px;
}

/* Adjust keyword columns in sidebar */
#side-sortables .keyword-column {
    margin-bottom: 8px;
}

#side-sortables .keyword-row {
    margin-bottom: 10px;
}

/* Optimize spacing in normal view */
.keyword-row {
    margin-bottom: 15px;
}

.keyword-column label {
    margin-bottom: 5px;
    display: inline-block;
}

/* Ensure proper form styling */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.meta-group {
    margin-bottom: 20px;
}

.meta-form {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.meta-form input[type="checkbox"] {
    margin-right: 10px;
}

.tooltip {
    margin-left: 5px;
    color: #666;
    cursor: help;
    position: relative;
}

.tooltip i {
    font-style: normal;
    font-size: 12px;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    background: #666;
    color: #fff;
    border-radius: 50%;
    display: inline-block;
}

.tooltip-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
    min-width: 200px;
    max-width: 300px;
    font-size: 12px;
    line-height: 1.4;
    color: #23282d;
}

.tooltip:hover .tooltip-content {
    display: block;
}

/* Advanced tab specific styles */
#panel-advanced .inner-box {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#panel-advanced h3 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    color: #23282d;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

#panel-advanced .robots-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

#panel-advanced .meta-form {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #f9f9f9;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

#panel-advanced .meta-form:hover {
    background: #f0f0f0;
}

#panel-advanced .meta-form input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
}

#panel-advanced .meta-form .label-container {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
}

#panel-advanced .meta-form label {
    margin: 0;
    font-weight: 500;
    color: #23282d;
}

#panel-advanced .form-group {
    margin-bottom: 20px;
}

#panel-advanced .form-group .label-container {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
}

#panel-advanced .form-group label {
    margin: 0;
    font-weight: 500;
    color: #23282d;
}

#panel-advanced .form-group input[type="text"],
#panel-advanced .form-group input[type="number"],
#panel-advanced .form-group select {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #23282d;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

#panel-advanced .form-group input[type="text"]:focus,
#panel-advanced .form-group input[type="number"]:focus,
#panel-advanced .form-group select:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 1px #0073aa;
}

#panel-advanced .tooltip {
    color: #666;
    cursor: help;
    position: relative;
}

#panel-advanced .tooltip i {
    font-style: normal;
    font-size: 12px;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    background: #666;
    color: #fff;
    border-radius: 50%;
    display: inline-block;
}

#panel-advanced .tooltip-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
    min-width: 200px;
    max-width: 300px;
    font-size: 12px;
    line-height: 1.4;
    color: #23282d;
}

#panel-advanced .tooltip:hover .tooltip-content {
    display: block;
}

/* Keyword Selection UI */
.keyword-selection-container {
    margin-bottom: 10px;
    width: 100%;
}

.keyword-dropdown {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    font-size: 12px;
}

.keyword-dropdown:hover, .keyword-dropdown:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

/* Adjust dropdown in sidebar */
#side-sortables .keyword-dropdown {
    padding: 5px 20px 5px 6px !important;
    font-size: 11px !important;
    background-size: 12px !important;
    background-position: right 4px center !important;
}

#side-sortables .keyword-selection-container {
    margin-bottom: 8px;
}

/* Adjust the option text for all browsers */
.keyword-dropdown option {
    font-size: 12px;
    padding: 2px;
}

#new-main-keyword {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#new-main-keyword:hover, #new-main-keyword:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
    outline: none;
}

#set-main-keyword-btn {
    transition: background-color 0.2s ease;
}

#set-main-keyword-btn:hover {
    background-color: #006291;
}

/* Keyword tag styles */
.keyword-tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background-color: #e6f2ff;
    border: 1px solid #2271b1;
    border-radius: 16px;
    margin-right: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    color: #2271b1;
}

.keyword-tag:hover {
    background-color: #d6ebff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.keyword-tag.main-keyword {
    background-color: #2271b1;
    color: white;
    border-color: #2271b1;
}

/* Styles for tracked keywords */
.keyword-tag.is-tracked {
    border-color: #00a32a;
    background-color: #e6f7ee;
    color: #00852c;
}

.keyword-tag.is-tracked:hover {
    background-color: #d1f2e0;
}

.keyword-tag.is-tracked.main-keyword {
    background-color: #00a32a;
    color: white;
    border-color: #00a32a;
}

.keyword-tag .track-icon {
    margin-right: 5px;
    font-size: 14px;
}

.keyword-tag .tag-text {
    margin-right: 6px;
    font-weight: 500;
}

.keyword-tag .tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: rgba(0,0,0,0.1);
    font-size: 12px;
    font-weight: bold;
    color: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 4px;
}

.keyword-tag .tag-remove:hover {
    background-color: rgba(0,0,0,0.2);
    transform: scale(1.1);
}

.keyword-tag.main-keyword .tag-remove:hover {
    background-color: rgba(255,255,255,0.3);
}

/* Context menu styles */
#keyword-context-menu {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    border: 1px solid #ddd;
}

.context-menu-item {
    color: #333;
    transition: background-color 0.2s ease;
}

.context-menu-item:hover {
    background-color: #f0f0f0;
}

/* Improved add keyword container styling */
.add-keyword-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    background-color: #f9f9f9;
}

#track-new-keyword {
    margin-right: 5px;
}

/* Sidebar specific styling */
#side-sortables .add-keyword-container {
    flex-direction: column;
    gap: 8px;
}

#side-sortables .add-keyword-container > div {
    margin-bottom: 5px;
}

.aysa-keyword-associated {
    border-color: #4caf50 !important;
    background-color: #e8f5e9 !important;
}

/* Responsive adjustments */
@media screen and (max-width: 782px) {
    #panel-advanced .robots-meta {
        grid-template-columns: 1fr;
    }
    
    #panel-advanced .form-group input[type="text"],
    #panel-advanced .form-group input[type="number"],
    #panel-advanced .form-group select {
        max-width: 100%;
    }
    
    .keyword-input-group {
        flex-direction: column;
        gap: 10px;
    }
    
    #set-main-keyword-btn {
        align-self: flex-start;
    }
}

/* Toast notification styles */
#aysa-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.aysa-toast {
    min-width: 250px;
    max-width: 350px;
    padding: 12px 16px;
    border-radius: 4px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.16);
    margin-bottom: 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aysa-toast-success {
    background-color: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.aysa-toast-error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.aysa-toast-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.aysa-toast-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

@keyframes aysa-toast-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes aysa-toast-out {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Custom Confirm Dialog */
.aysa-confirm-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aysa-confirm-dialog {
    background-color: #fff;
    border-radius: 6px;
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
    padding: 20px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.aysa-confirm-message {
    margin-bottom: 20px;
    font-size: 16px;
}

.aysa-confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.aysa-confirm-cancel {
    background-color: #6c757d;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
}

.aysa-confirm-ok {
    background-color: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
}

/* Modern Action Buttons - FIXED VIBRANT STYLES */
.aysa-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 16px !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
    border: none !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    white-space: nowrap !important;
    min-height: 36px !important;
    margin: 5px 0 !important;
    text-transform: none !important;
    line-height: 1.4 !important;
}

.aysa-button:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.3) !important;
}

.aysa-button:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
    filter: brightness(1.1) !important;
}

.aysa-button:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2) !important;
}

.aysa-button svg {
    margin-right: 8px !important;
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
}

/* Primary buttons - VIBRANT GREEN */
.aysa-button-primary {
    background: #2ea043 !important;
    color: white !important;
    border-color: #2ea043 !important;
}

.aysa-button-primary:hover, .aysa-button-primary:focus {
    background: #238636 !important;
    color: white !important;
    border-color: #238636 !important;
}

/* Action buttons - VIBRANT ORANGE */
.aysa-button-action {
    background: #ff6b6b !important;
    color: white !important;
    border-color: #ff6b6b !important; 
}

.aysa-button-action:hover, .aysa-button-action:focus {
    background: #e74c3c !important;
    color: white !important;
    border-color: #e74c3c !important;
}

/* Success buttons - VIBRANT GREEN */
.aysa-button-success {
    background: #00a32a !important;
    color: white !important;
    border-color: #00a32a !important;
}

.aysa-button-success:hover, .aysa-button-success:focus {
    background: #008a20 !important;
    color: white !important;
    border-color: #008a20 !important;
}

/* Button group in the tab container - responsive */
.tab-container .button-group {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    margin-top: 10px !important;
}

/* Ensure spinner is visible */
.spinner.is-active {
    visibility: visible !important;
    display: inline-block !important;
    margin: 0 10px !important;
}

/* Fix for WordPress admin compatibility */
.wp-core-ui .aysa-button {
    color: white !important;
}

/* Side panel adjustments */
#side-sortables .aysa-button {
    width: 100% !important;
    margin-bottom: 8px !important;
    text-align: center !important;
    font-size: 12px !important;
    padding: 6px 12px !important;
    min-height: 32px !important;
}

#side-sortables .tab-container .button-group {
    flex-direction: column !important;
    gap: 5px !important;
    width: 100% !important;
}

#side-sortables #get-seo-btn,
#side-sortables #edit-snippet-btn {
    display: block !important;
    width: 100% !important;
    margin-bottom: 5px !important;
}

/* Fix for button icons */
.aysa-button-icon svg {
    display: inline-block !important;
    vertical-align: middle !important;
    fill: currentColor !important;
}

/* Sidebar optimizations for keywords */
#side-sortables .keyword-tag {
    padding: 4px 8px;
    font-size: 11px;
    margin-right: 5px;
    margin-bottom: 5px;
}

#side-sortables .keyword-tag .tag-remove {
    width: 15px;
    height: 15px;
    font-size: 10px;
}

#side-sortables .add-keyword-container input {
    font-size: 11px !important;
    padding: 4px 6px !important;
    min-height: 26px !important;
}

#side-sortables .add-keyword-container button {
    font-size: 11px !important;
    padding: 2px 6px !important;
    min-height: 26px !important;
}

#side-sortables #new-secondary-keyword::placeholder {
    font-size: 11px;
}

/* Adjust form inputs in sidebar */
#side-sortables input[type="text"],
#side-sortables textarea {
    padding: 6px !important;
    font-size: 12px !important;
}

/* Reduce spacing in sidebar view for entire form */
#side-sortables .sub-group {
    margin-bottom: 12px !important;
}

/* Position the Generate SEO Suggestions button centrally in sidebar */
#side-sortables #generate-suggestions-btn {
    font-size: 12px !important;
    padding: 6px 10px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    display: inline-block !important;
    margin: 5px auto !important;
}

/* Adjust the inner-box inside sidebar panels */
#side-sortables .panel .inner-box:first-child {
    margin-top: 0;
}

/* Make meta fields stack vertically for better readability */
.keyword-row.meta-field-row {
    margin-bottom: 15px;
}

/* Apply stacked layout ONLY in the sidebar */
#side-sortables .keyword-row.meta-field-row {
    flex-direction: column;
}

.keyword-row.meta-field-row .keyword-column {
    /* Keep the original width for normal views */
    margin-bottom: 8px;
}

/* Apply full width ONLY in the sidebar */
#side-sortables .keyword-row.meta-field-row .keyword-column {
    width: 100%;
}

.keyword-row.meta-field-row .keyword-column input,
.keyword-row.meta-field-row .keyword-column textarea {
    width: 100%;
    margin-bottom: 5px;
}

.keyword-row.meta-field-row .keyword-button {
    align-self: flex-end;
    margin-top: 5px;
}

/* Improve spacing between meta fields */
.sub-group.meta-field-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.sub-group.meta-field-group:last-child {
    border-bottom: none;
}

/* More specific selectors for meta fields in sidebar */
#side-sortables .keyword-row.meta-field-row .keyword-column {
    margin-bottom: 5px;
}

#side-sortables .keyword-row.meta-field-row .keyword-button {
    margin-top: 2px;
}

#side-sortables .sub-group.meta-field-group {
    margin-bottom: 15px;
    padding-bottom: 10px;
}

/* Suggested fields styling - ONLY in sidebar */
#side-sortables .keyword-row.meta-field-row .keyword-column:nth-child(2) {
    background-color: #f9f9f9;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #eee;
}

#side-sortables .keyword-row.meta-field-row .keyword-column:nth-child(2) label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    display: block;
}

/* Main field styling improvements - ONLY in sidebar */
#side-sortables .keyword-row.meta-field-row .keyword-column:first-child {
    margin-bottom: 12px;
}

#side-sortables .keyword-row.meta-field-row .keyword-column:first-child input,
#side-sortables .keyword-row.meta-field-row .keyword-column:first-child textarea {
    padding: 8px;
    font-size: 13px;
}

/* Make the buttons more prominent - ONLY in sidebar */
#side-sortables .keyword-row.meta-field-row .keyword-button {
    margin-top: 8px;
    text-align: right;
}

/* Increase spacing between label and tooltip - ONLY in sidebar */
#side-sortables .keyword-row.meta-field-row .label-container {
    margin-bottom: 5px;
}

/* Sidebar specific meta field improvements */
#side-sortables .keyword-row.meta-field-row .keyword-column:nth-child(2) {
    padding: 6px;
    margin-bottom: 10px;
}

#side-sortables .keyword-row.meta-field-row .keyword-button {
    text-align: center;
    margin: 0 auto;
    display: block;
}

#side-sortables .keyword-row.meta-field-row .keyword-button .aysa-button {
    width: 100%;
    padding: 6px 8px;
    font-size: 12px;
}

#side-sortables .keyword-row.meta-field-row textarea {
    min-height: 60px;
    height: 60px;
}

/* Ensure the meta title, description and keywords fields have proper max-width */
#side-sortables #aysa-entity-meta-title,
#side-sortables #aysa-entity-meta-description,
#side-sortables #aysa-entity-meta-keywords,
#side-sortables #aysa-entity-suggested-meta-title,
#side-sortables #aysa-entity-suggested-meta-description,
#side-sortables #aysa-entity-suggested-meta-keywords {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Improve regular horizontal layout for meta fields */
.keyword-row.meta-field-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
}

.keyword-row.meta-field-row .keyword-column {
    flex: 1; /* Each column takes equal space */
    min-width: 200px; /* Minimum width for readability */
}

.keyword-row.meta-field-row .keyword-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 28px; /* Align with input fields below their labels */
}

/* Add some space between bar-container and the next element */
.keyword-row.meta-field-row .bar-container {
    margin-bottom: 10px;
}

/* Make the suggested fields look nice in horizontal layout */
.keyword-row.meta-field-row .keyword-column:nth-child(2) {
    position: relative;
    background-color: #f9f9f9;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #eee;
}

.keyword-row.meta-field-row .keyword-column:nth-child(2) label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    display: block;
}

@media (max-width: 782px) {
    /* For small screens, stack even in the regular layout */
    .keyword-row.meta-field-row {
        flex-direction: column;
    }
    
    .keyword-row.meta-field-row .keyword-column {
        width: 100%;
    }
    
    .keyword-row.meta-field-row .keyword-button {
        padding-top: 0;
        align-items: flex-start;
        margin-top: 5px;
    }
}

/* Error styling */
.error-message {
    color: #d63638;
    font-size: 12px;
    margin-top: 5px;
    padding: 3px 8px;
    background-color: rgba(214, 54, 56, 0.1);
    border-radius: 3px;
    display: inline-block;
}

input.has-error,
textarea.has-error {
    border-color: #d63638 !important;
    background-color: rgba(214, 54, 56, 0.05) !important;
}

/* Style for empty keyword containers */
#secondary-keywords-container .empty-placeholder,
#secondary-keywords-container .error-placeholder {
    padding: 8px;
    border-radius: 4px;
    font-style: italic;
    font-size: 13px;
}

#secondary-keywords-container .empty-placeholder {
    background-color: #f0f0f1;
    color: #757575;
}

#secondary-keywords-container .error-placeholder {
    background-color: rgba(214, 54, 56, 0.1);
    color: #d63638;
}

/* Scoring System Styles */
#panel-score .inner-box {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#panel-score h3 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    color: #23282d;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.scoring-category {
    margin-bottom: 15px;
}

.scoring-category h4 {
    font-size: 1.1em;
    margin-bottom: 10px;
    color: #333;
}

.scoring-criteria {
    list-style: none;
    padding-left: 0;
}

.scoring-criteria li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.scoring-criteria li:last-child {
    border-bottom: none;
}

.criterion-label {
    flex-grow: 1;
    color: #555;
}

.criterion-score {
    font-weight: bold;
    color: #23282d;
}

.total-score-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.total-score-container h4 {
    font-size: 1.2em;
    color: #23282d;
    text-align: right;
}

#total-score-value {
    font-weight: bold;
}

/* General Styles */
.btn-universal {
    margin-top: 5px;
}

/* ✅ Character Count Styling */
.character-count {
    transition: color 0.3s ease;
    font-weight: 500;
}

.character-count.meta-subtitle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 4px 0 7px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    border: 1px solid #dce4ef;
    background: #f8fbff;
}

.character-count.meta-subtitle .char-status {
    font-weight: 600;
}

/* Meta Title Character Count (50-60 optimal) */
.character-count.meta-subtitle.is-optimal {
    color: #28a745 !important; /* Green for 50-60 characters */
    border-color: rgba(40, 167, 69, 0.3);
    background: rgba(40, 167, 69, 0.08);
}

.character-count.meta-subtitle.is-warning {
    color: #ffc107 !important; /* Yellow for 40-49 or 61-70 characters */
    border-color: rgba(255, 193, 7, 0.35);
    background: rgba(255, 193, 7, 0.12);
}

.character-count.meta-subtitle.is-error {
    color: #dc3545 !important; /* Red for under 40 or over 70 characters */
    border-color: rgba(220, 53, 69, 0.3);
    background: rgba(220, 53, 69, 0.08);
}

/* Meta Description Character Count (150-160 optimal) */
/* Character count emphasis */
.character-count .char-count {
    font-weight: 600;
    font-size: 13px;
}

/* Improve regular horizontal layout for meta fields */
.keyword-row.meta-field-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
}

.keyword-row.meta-field-row .keyword-column {
    flex: 1; /* Each column takes equal space */
    min-width: 200px; /* Minimum width for readability */
}

.keyword-row.meta-field-row .keyword-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 28px; /* Align with input fields below their labels */
}

/* Add some space between bar-container and the next element */
.keyword-row.meta-field-row .bar-container {
    margin-bottom: 10px;
}

/* Make the suggested fields look nice in horizontal layout */
.keyword-row.meta-field-row .keyword-column:nth-child(2) {
    position: relative;
    background-color: #f9f9f9;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #eee;
}

.keyword-row.meta-field-row .keyword-column:nth-child(2) label {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
    display: block;
}

@media (max-width: 782px) {
    /* For small screens, stack even in the regular layout */
    .keyword-row.meta-field-row {
        flex-direction: column;
    }
    
    .keyword-row.meta-field-row .keyword-column {
        width: 100%;
    }
    
    .keyword-row.meta-field-row .keyword-button {
        padding-top: 0;
        align-items: flex-start;
        margin-top: 5px;
    }
}

@media (max-width: 640px) {
    .character-count.meta-subtitle {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}
