/* GB Ad Inserter - Professional Admin Styles */

.gb-ai-settings {
    max-width: 1400px;
    margin: 30px 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    border: 1px solid #e2e8f0;
    margin-left: -20px;
}

/* Header Layout */
.gb-ai-header {
    background: linear-gradient(135deg, #2c5530 0%, #4a7c59 100%);
    color: #fff;
    margin: 0;
    padding: 35px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.gb-ai-header h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #fff;
}

.gb-ai-header-actions {
    display: flex;
    align-items: center;
}

.gb-ai-donate-header-btn {
    background: rgba(255, 255, 255, 0.15) !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    color: #fff !important;
    padding: 12px 20px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    backdrop-filter: blur(10px) !important;
}

.gb-ai-donate-header-btn:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    color: #fff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2) !important;
    text-decoration: none !important;
}

/* Professional Code Editor */
.gb-ai-code-editor {
    position: relative;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: #1e1e1e;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    min-height: 200px;
    display: block;
}

.gb-ai-code-editor:hover {
    border-color: #2c5530;
    box-shadow: 0 6px 20px rgba(44, 85, 48, 0.15);
}

.gb-ai-line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    width: 60px;
    height: 100%;
    background: #252526;
    border-right: 1px solid #3c3c3c;
    color: #858585;
    font-size: 13px;
    line-height: 1.6;
    padding: 16px 8px;
    text-align: right;
    user-select: none;
    z-index: 1;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Menlo', monospace;
    overflow: hidden;
    white-space: pre;
}

.gb-ai-line-numbers .line-number {
    display: block;
    padding: 0 4px;
    border-radius: 2px;
    transition: background-color 0.2s ease;
    min-height: 1.6em;
}

.gb-ai-line-numbers .line-number:hover {
    background: #3c3c3c;
    color: #fff;
}

.gb-ai-code-textarea {
    width: 100%;
    border: none;
    background: #1e1e1e;
    padding: 16px 16px 16px 80px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    min-height: 200px;
    outline: none;
    color: #d4d4d4;
    caret-color: #fff;
    display: block;
}

.gb-ai-code-textarea:focus {
    background: #1e1e1e;
}

.gb-ai-code-textarea::placeholder {
    color: #6a6a6a;
}

/* Script Templates */
.gb-ai-script-templates {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gb-ai-template-btn {
    padding: 8px 16px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.gb-ai-template-btn:hover {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

/* Syntax Highlighting */
.gb-ai-code-textarea.adsense-code {
    background: #1e1e1e;
    border-left: 4px solid #fbbf24;
}

.gb-ai-code-textarea.facebook-code {
    background: #1e1e1e;
    border-left: 4px solid #3b82f6;
}

.gb-ai-code-textarea.analytics-code {
    background: #1e1e1e;
    border-left: 4px solid #8b5cf6;
}

.gb-ai-code-textarea.css-code {
    background: #1e1e1e;
    border-left: 4px solid #10b981;
}

/* Frontend Ad Container Styles */
.gb-ai-ad {
    margin: 20px 0;
    text-align: center;
    clear: both;
}

.gb-ai-ad iframe {
    max-width: 100%;
    height: auto;
}

.gb-ai-ad ins {
    display: block;
    margin: 0 auto;
}

/* Archive page ad containers */
.gb-ai-archive-below-header {
    margin-bottom: 30px;
}

.gb-ai-archive-above-footer {
    margin-top: 30px;
}

/* Post page ad containers */
.gb-ai-post-below-header {
    margin-bottom: 30px;
}

.gb-ai-post-beginning {
    margin-bottom: 25px;
}

.gb-ai-post-middle {
    margin: 25px 0;
}

.gb-ai-post-end {
    margin-top: 25px;
}

.gb-ai-post-before-paragraph-1,
.gb-ai-post-before-paragraph-2,
.gb-ai-post-before-paragraph-3 {
    margin: 15px 0;
}

.gb-ai-tabs {
    background: #fff;
    overflow: hidden;
}

.gb-ai-tab-nav {
    display: flex;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #e2e8f0;
    margin: 0;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.gb-ai-tab-link {
    display: flex;
    align-items: center;
    padding: 22px 32px;
    text-decoration: none;
    color: #64748b;
    font-weight: 600;
    font-size: 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    position: relative;
    letter-spacing: -0.025em;
}

.gb-ai-tab-link:hover {
    background: rgba(44, 85, 48, 0.05);
    color: #475569;
    text-decoration: none;
    transform: translateY(-1px);
}

.gb-ai-tab-link.active {
    background: #fff;
    color: #2c5530;
    border-bottom-color: #2c5530;
    font-weight: 700;
    box-shadow: 0 -2px 8px rgba(44, 85, 48, 0.1);
}

.gb-ai-tab-link.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #2c5530 0%, #4a7c59 100%);
}

.gb-ai-tab-content {
    display: none;
    padding: 40px;
    background: #fff;
}

.gb-ai-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Form Styling */
.gb-ai-field-group {
    margin-bottom: 35px;
    padding: 30px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.gb-ai-field-group:hover {
    border-color: #2c5530;
    box-shadow: 0 8px 24px rgba(44, 85, 48, 0.12);
    transform: translateY(-3px);
}

.gb-ai-field-group label {
    display: block;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
    font-size: 16px;
    letter-spacing: -0.025em;
}

.gb-ai-field-group .description {
    margin-top: 10px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

/* Field Header and Controls */
.gb-ai-field-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 20px;
}

.gb-ai-field-header > label {
    flex: 1;
    margin-bottom: 0;
}

.gb-ai-field-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.gb-ai-control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 120px;
}

.gb-ai-control-group label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}

.gb-ai-select {
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    transition: all 0.3s ease;
    min-width: 120px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.gb-ai-select:focus {
    border-color: #2c5530;
    box-shadow: 0 0 0 3px rgba(44, 85, 48, 0.15);
    outline: none;
    transform: translateY(-1px);
}

.gb-ai-select:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.gb-ai-number-input {
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    transition: all 0.3s ease;
    width: 90px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.gb-ai-number-input:focus {
    border-color: #2c5530;
    box-shadow: 0 0 0 3px rgba(44, 85, 48, 0.15);
    outline: none;
    transform: translateY(-1px);
}

.gb-ai-number-input:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Field Footer */
.gb-ai-field-footer {
    margin-top: 15px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.gb-ai-preview-info {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.gb-ai-preview-label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gb-ai-preview-alignment,
.gb-ai-preview-margins {
    font-size: 13px;
    color: #64748b;
}

.gb-ai-preview-alignment strong,
.gb-ai-preview-margins strong {
    color: #1e293b;
    font-weight: 600;
}

/* Section Headers */
.gb-ai-settings h2 {
    color: #1e293b;
    font-size: 24px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.gb-ai-settings h3 {
    color: #475569;
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 600;
}

/* Shortcode Management */
.gb-ai-shortcode-form {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 35px;
    border-radius: 16px;
    margin-bottom: 35px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.gb-ai-shortcode-form h3 {
    margin-top: 0;
    color: #1e293b;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 25px;
}

.gb-ai-shortcode-inputs {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.gb-ai-shortcode-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gb-ai-shortcode-field label {
    font-weight: 600;
    color: #1e293b;
    font-size: 15px;
}

.gb-ai-text-input {
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    background: #fff;
}

.gb-ai-text-input:focus {
    border-color: #2c5530;
    box-shadow: 0 0 0 3px rgba(44, 85, 48, 0.15);
    outline: none;
}

.gb-ai-shortcode-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.gb-ai-shortcode-list {
    margin-top: 35px;
}

.gb-ai-shortcode-list h3 {
    margin-bottom: 25px;
    color: #1e293b;
    font-size: 22px;
    font-weight: 700;
}

.gb-ai-shortcode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.gb-ai-shortcode-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.gb-ai-shortcode-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.gb-ai-shortcode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f1f5f9;
}

.gb-ai-shortcode-header h4 {
    margin: 0;
    color: #1e293b;
    font-size: 16px;
    font-weight: 700;
}

.gb-ai-shortcode-actions {
    display: flex;
    gap: 8px;
}

.gb-ai-shortcode-preview {
    margin-bottom: 15px;
}

.gb-ai-shortcode-preview code {
    background: #1e293b;
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    border: 1px solid #334155;
    display: inline-block;
}

.gb-ai-shortcode-content {
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
}

.gb-ai-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px dashed #cbd5e1;
}

.gb-ai-empty-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.gb-ai-empty-state h3 {
    color: #1e293b;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
}

.gb-ai-empty-state p {
    color: #64748b;
    font-size: 16px;
}

/* Notice System */
.gb-ai-notice {
    position: fixed;
    top: 32px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease;
}

.gb-ai-notice.success {
    background: #10b981;
    color: #fff;
    border-left: 4px solid #059669;
}

.gb-ai-notice.error {
    background: #ef4444;
    color: #fff;
    border-left: 4px solid #dc2626;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading State */
.gb-ai-loading {
    position: relative;
}

.gb-ai-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1000;
}

.gb-ai-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #2c5530;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1001;
}

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

/* Donation Section */
.gb-ai-donation-section {
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #fef7f0 0%, #fef3e2 100%);
    border: 1px solid #fed7aa;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.gb-ai-donation-content h3 {
    color: #d97706;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}

.gb-ai-donation-content p {
    color: #92400e;
    font-size: 16px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.gb-ai-donate-btn {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
    border: none !important;
    color: #fff !important;
    font-weight: 600 !important;
    padding: 12px 24px !important;
    font-size: 15px !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3) !important;
}

.gb-ai-donate-btn:hover {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.4) !important;
}

/* Buttons */
.gb-ai-settings .button-primary {
    background: linear-gradient(135deg, #2c5530 0%, #4a7c59 100%);
    border: none;
    color: #fff;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(44, 85, 48, 0.3);
}

.gb-ai-settings .button-primary:hover {
    background: linear-gradient(135deg, #1e3a22 0%, #3d6b4a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 85, 48, 0.4);
}

.gb-ai-settings .button-small {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
    font-weight: 500;
}

.delete-shortcode {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: none;
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.delete-shortcode:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Section Headers */
.gb-ai-settings h2 {
    color: #333;
    font-size: 20px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.gb-ai-settings h3 {
    color: #555;
    font-size: 16px;
    margin-bottom: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gb-ai-settings {
        margin: 15px 0;
        margin-left: -10px;
        border-radius: 8px;
    }
    
    .gb-ai-header {
        padding: 20px 25px;
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .gb-ai-header h1 {
        padding: 0;
        font-size: 24px;
    }
    
    .gb-ai-donate-header-btn {
        padding: 10px 16px !important;
        font-size: 13px !important;
    }
    
    .gb-ai-tab-nav {
        flex-direction: column;
    }
    
    .gb-ai-tab-link {
        text-align: center;
        border-bottom: 1px solid #e2e8f0;
        border-right: none;
        padding: 15px 20px;
    }
    
    .gb-ai-tab-link.active {
        border-bottom-color: #667eea;
        border-right: none;
    }
    
    .gb-ai-tab-content {
        padding: 25px;
    }
    
    .gb-ai-field-group {
        padding: 20px;
    }
    
    .gb-ai-code-editor {
        font-size: 13px;
    }
    
    .gb-ai-line-numbers {
        width: 50px;
        padding: 12px 6px;
    }
    
    .gb-ai-code-textarea {
        padding: 12px 12px 12px 70px;
        font-size: 13px;
    }
    
    .gb-ai-script-templates {
        flex-direction: column;
    }
    
    .gb-ai-template-btn {
        width: 100%;
        text-align: center;
    }
    
    .gb-ai-field-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .gb-ai-field-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .gb-ai-control-group {
        min-width: 80px;
    }
    
    .gb-ai-preview-info {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}

/* Loading States */
.gb-ai-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Success/Error Messages */
.gb-ai-notice {
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 4px;
    border-left: 4px solid;
}

.gb-ai-notice.success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.gb-ai-notice.error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

/* Code Preview */
.gb-ai-code-preview {
    background: #f8f9fa;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    padding: 15px;
    margin-top: 10px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.4;
    color: #333;
    max-height: 200px;
    overflow-y: auto;
}

/* Tooltips */
.gb-ai-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.gb-ai-tooltip .gb-ai-tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 12px;
    line-height: 1.4;
}

.gb-ai-tooltip:hover .gb-ai-tooltiptext {
    visibility: visible;
    opacity: 1;
}
