/* SEO Editor Full Page Styles */

/* Layout & Grid */
.seo-editor-fullpage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f8f9fa;
    z-index: 9999;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.seo-editor-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.seo-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-back {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6c757d;
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-back:hover {
    background: #f1f3f5;
    color: #212529;
}

.product-info h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #212529;
}

.product-sku {
    color: #868e96;
    font-size: 0.875rem;
}

/* Header Right Actions */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-purple-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.3);
}

.btn-purple-gradient:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-1px);
}

.btn-gold-gradient {
    background: linear-gradient(45deg, #b08d4b 0%, #e6d4a8 50%, #b08d4b 100%);
    color: #3e2b06;
    border: none;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(176, 141, 75, 0.3);
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-gold-gradient:hover {
    background: linear-gradient(45deg, #c49d5b 0%, #f0e4b8 50%, #c49d5b 100%);
    color: #2b1d03;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(176, 141, 75, 0.4);
}

/* Comparison Layout */
.seo-comparison-wrapper {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0; /* Allow flex scrolling */
}

.seo-column {
    flex: 1;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.seo-column.history-column {
    background: #f8f9fa; /* Slightly darker to indicate history/read-only */
    border: 1px dashed #dee2e6;
}

.column-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.history-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-nav {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #495057;
}

.btn-nav:hover:not(:disabled) {
    background: #e9ecef;
    color: #212529;
}

.btn-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.column-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Form Fields */
.seo-field-group {
    margin-bottom: 20px;
}

.seo-field-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 500;
    color: #495057;
    font-size: 0.9rem;
}

.char-limit {
    font-size: 0.75rem;
    color: #adb5bd;
}

.seo-input-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
}

.seo-input, .seo-textarea {
    width: 100%;
    padding: 10px 12px;
    padding-right: 45px; /* Space for AI button */
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    background: #fff;
}

.seo-input:focus, .seo-textarea:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.history-column .seo-input, 
.history-column .seo-textarea {
    background-color: #f1f3f5;
    color: #495057;
    cursor: default;
}

/* Magic AI Button */
.ai-magic-btn {
    position: absolute;
    right: -10px;
    top: -10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%); /* Softer purple/pink magic look */
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2;
}

.ai-magic-btn:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 2px 8px rgba(161, 140, 209, 0.5);
}

.ai-magic-btn svg {
    width: 14px;
    height: 14px;
}

/* Character Count & Alerts */
.char-count {
    text-align: right;
    font-size: 0.75rem;
    margin-top: 4px;
    color: #868e96;
}

.char-count.text-success { color: #28a745; }
.char-count.text-warning { color: #ffc107; font-weight: 500; }
.char-count.text-danger { color: #dc3545; font-weight: 600; }

/* Score Badge */
.seo-score-display {
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    background: #e9ecef;
    color: #495057;
}

.score-high { background: #d4edda; color: #155724; }
.score-mid { background: #fff3cd; color: #856404; }
.score-low { background: #f8d7da; color: #721c24; }

/* History Controls footer */
.history-controls {
    margin-top: 20px;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    display: flex;
    align-items: center;
}

/* Primary Keyword Field - Special Styling */
.seo-field-group.primary-keyword-field {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 25px;
}

.primary-keyword-badge {
    display: inline-block;
    background: #667eea;
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    font-weight: 600;
    text-transform: uppercase;
}

.optional-badge {
    display: inline-block;
    background: transparent;
    color: #667eea;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid #667eea;
}



.seo-field-help {
    display: block;
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 6px;
    font-style: italic;
    line-height: 1.4;
}

/* Pending Changes Badge */
.pending-changes-badge {
    background: #ffc107;
    color: #000;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Dynamic Fields Spacing */
#dynamic-seo-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Spinner Animation */
@keyframes spinner-border {
  to { transform: rotate(360deg); }
}

.spinner-border {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  vertical-align: text-bottom;
  border: 0.2em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-border .75s linear infinite;
}

/* Simple HTML Toolbar */
.html-toolbar {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
    background: #f1f3f5;
    padding: 5px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    flex-wrap: wrap;
}

.html-tool-btn {
    background: white;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}


/* Read-only (View Mode) Styles */
.seo-input-readonly {
    background-color: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    cursor: text;
    transition: all 0.2s;
}
.seo-input-readonly:hover {
    background-color: #f8f9fa !important;
    border-color: #e9ecef !important;
    cursor: pointer;
}

/* Keyword Suggestions */
.keyword-suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    animation: fadeIn 0.3s ease;
}

.keyword-chip {
    background: #f1f3f5;
    color: #495057;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.keyword-chip:hover {
    background: #e7f5ff;
    color: #1971c2;
    border-color: #a5d8ff;
    transform: translateY(-1px);
}

.keyword-chip-close {
    margin-left: auto;
    cursor: pointer;
    color: #adb5bd;
    font-size: 1.2rem;
    line-height: 0.8;
    padding: 0 5px;
}

.keyword-chip-close:hover {
    color: #dc3545;
}

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

/* History Changes List Styles */
.history-changes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-change-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s;
}

.history-change-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.change-attr-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #495057;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.change-attr-label::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
}

/* Stacked layout for before/after */
.change-values {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.85rem;
}

.change-original,
.change-new {
    background: #f8f9fa;
    padding: 10px 12px;
    border-radius: 6px;
    min-height: 40px;
}

.change-original {
    background: #fff5f5;
    border-left: 3px solid #dc3545;
}

.change-new {
    background: #f0fff4;
    border-left: 3px solid #28a745;
}

.change-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #868e96;
    margin-bottom: 4px;
}

.change-value {
    color: #495057;
    word-break: break-word;
    line-height: 1.4;
    white-space: pre-wrap;
}

.change-arrow {
    display: none; /* Hide arrow in stacked layout */
}

/* History Controls in Column */
.history-column .history-controls {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    border: none;
    border-radius: 0;
    justify-content: space-between;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .change-values {
        flex-direction: column;
    }
}


/* Source language fallback indicator */
.source-lang-fallback {
    border-color: #ffc107 !important;
    background-color: #fffdf0 !important;
}
.source-lang-fallback:focus {
    border-color: #e0a800 !important;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.15) !important;
}
