/**
 * Admin Interface CSS
 * File: assets/css/admin-interface.css
 */

/* ==========================================================================
   Connection Mode Selector
   ========================================================================== */

.connection-mode-selector {
    margin: 20px 0 30px;
}

.connection-mode-selector.enhanced {
    max-width: 1200px;
}

.connection-mode-selector .mode-selector-header {
    text-align: center;
    margin-bottom: 24px;
}

.connection-mode-selector .mode-selector-header h3 {
    margin-bottom: 8px;
    font-size: 22px;
    color: #1d2327;
}

.connection-mode-selector .mode-selector-header p {
    margin: 0;
    color: #50575e;
}

.connection-mode-selector .connection-modes,
.connection-mode-selector:not(.enhanced) {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.connection-mode-selector.enhanced .connection-modes {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.connection-mode-selector label.connection-option,
.connection-mode-selector .connection-option {
    display: block;
    cursor: pointer;
    position: relative;
}

.connection-mode-selector .connection-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.connection-mode-selector .option-card {
    border: 2px solid #dcdcde;
    border-radius: 10px;
    padding: 20px 22px;
    background: #fff;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.connection-mode-selector label.connection-option:hover .option-card,
.connection-mode-selector label.connection-option:focus-within .option-card {
    border-color: #2271b1;
    box-shadow: 0 8px 22px rgba(34, 113, 177, 0.14);
}

.connection-mode-selector .connection-option input[type="radio"]:checked+.option-card,
.connection-mode-selector label.connection-option.active .option-card {
    border-color: #00a32a;
    background: #f5fbf5;
    box-shadow: 0 14px 28px rgba(0, 163, 42, 0.15);
}

.connection-mode-selector .option-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.connection-mode-selector .option-header h4 {
    margin: 0;
    font-size: 18px;
    color: #1d2327;
}

.connection-mode-selector .option-badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.connection-mode-selector .option-badge.recommended {
    background: #e7f3ff;
    color: #2271b1;
}

.connection-mode-selector .option-badge.power {
    background: #fff2e7;
    color: #d63638;
}

.connection-mode-selector .option-badge.premium {
    background: #f0e7ff;
    color: #6b46c1;
}

.connection-mode-selector .option-badge.coming-soon {
    background: #f6f7f7;
    color: #646970;
}

.connection-mode-selector .option-description {
    margin: 0 0 16px;
    color: #50575e;
    line-height: 1.5;
}

.connection-mode-selector .feature-grid {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.connection-mode-selector .feature-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #2c3338;
}

.connection-mode-selector .feature-icon {
    flex-shrink: 0;
    line-height: 1.4;
}

.connection-mode-selector .option-stats {
    margin-top: auto;
    padding: 16px 0;
    border-top: 1px solid #dcdcde;
    border-bottom: 1px solid #dcdcde;
    text-align: center;
}

.connection-mode-selector .stats-row strong {
    display: block;
    font-size: 20px;
    color: #1d2327;
}

.connection-mode-selector .stats-row span {
    color: #646970;
    font-size: 13px;
}

.connection-mode-selector .option-pricing {
    text-align: center;
    margin-top: 18px;
}

.connection-mode-selector .option-pricing .price {
    font-size: 18px;
    font-weight: 600;
    color: #1d2327;
}

.connection-mode-selector .option-pricing .price-note {
    font-size: 12px;
    color: #646970;
}

.connection-mode-selector .connection-option-disabled .option-card {
    opacity: 0.65;
    border-style: dashed;
    border-color: #c3c4c7;
    background: #f6f7f7;
    box-shadow: none;
}

.connection-mode-selector .mode-recommendations {
    border: 1px solid #dcdcde;
    border-radius: 10px;
    padding: 20px;
    background: #f8f9ff;
    margin-bottom: 24px;
}

.connection-mode-selector .mode-recommendations h4 {
    margin: 0;
    font-size: 16px;
    color: #1d2327;
}

.connection-mode-selector .recommendation-cards {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.connection-mode-selector .rec-card {
    display: flex;
    gap: 12px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #dcdcde;
    padding: 14px 16px;
    align-items: flex-start;
}

.connection-mode-selector .rec-icon {
    font-size: 22px;
    line-height: 1;
}

.connection-mode-selector .rec-content strong {
    color: #2271b1;
    display: block;
    margin-bottom: 6px;
}

.connection-mode-selector .rec-content p {
    margin: 0;
    color: #50575e;
    font-size: 13px;
}

.connection-mode-selector .migration-notice {
    background: #edf7ff;
    border: 1px solid #cce4ff;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    color: #1d2327;
}

.connection-mode-selector .migration-notice h4 {
    margin: 0 0 6px;
    color: #0a66c2;
}

.connection-mode-selector .connection-option .option-card ul {
    list-style: none;
    padding-left: 0;
    margin: 15px 0;
}

.connection-mode-selector .connection-option .option-card li {
    margin: 8px 0;
    font-size: 14px;
    padding-left: 20px;
    position: relative;
}

.connection-mode-selector .connection-option .option-card li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: #46b450;
    border-radius: 50%;
}

.connection-mode-selector .api-service-preview {
    background: rgba(255, 255, 255, 0.8);
    border: 1px dashed #646970;
    border-radius: 8px;
    padding: 18px;
    text-align: center;
}

.connection-mode-selector .api-service-preview h5 {
    margin: 0 0 8px;
    color: #51575d;
    font-size: 16px;
}

.connection-mode-selector .api-service-preview p {
    margin: 0;
    color: #646970;
    font-style: italic;
}

@media (max-width: 782px) {

    .connection-mode-selector .connection-modes,
    .connection-mode-selector:not(.enhanced) {
        grid-template-columns: 1fr;
    }
}

body.aivesese-mode-lite .lite-mode-section {
    margin-top: 20px;
}

body:not(.aivesese-mode-lite) .lite-mode-section {
    display: none;
}

/* ==========================================================================
   License Key Section
   ========================================================================== */

.license-key-section {
    max-width: 600px;
    margin: 20px 0;
}

.license-status {
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid;
    margin-bottom: 15px;
}

.license-status.activated {
    background: #f0f9ff;
    border-left-color: #10b981;
    color: #065f46;
}

.license-status .dashicons {
    color: #10b981;
    margin-right: 8px;
    font-size: 18px;
}

.license-status strong {
    display: block;
    margin-bottom: 5px;
    font-size: 16px;
}

.license-status p {
    margin: 8px 0;
    font-size: 14px;
}

.license-loading {
    color: #f59e0b;
    padding: 10px;
    background: #fffbf0;
    border-radius: 4px;
    margin-top: 10px;
}

.license-error {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
}

.license-success {
    color: #065f46;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 4px;
    padding: 10px;
    margin-top: 10px;
}

/* ==========================================================================
   Help Section
   ========================================================================== */

.ai-supabase-help {
    margin: 20px 0;
}

.ai-supabase-help details {
    border: 1px solid #dcdcde;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-supabase-help__summary {
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
    background: #f8f9fa;
    border-radius: 6px 6px 0 0;
    font-weight: 600;
    color: #1d2327;
}

.ai-supabase-help__summary::-webkit-details-marker {
    display: none;
}

.ai-supabase-help__summary:after {
    content: '▾';
    float: right;
    transition: transform 0.2s ease;
    font-size: 14px;
    color: #646970;
}

.ai-supabase-help details[open] .ai-supabase-help__summary:after {
    transform: rotate(180deg);
}

.ai-supabase-help details>*:not(.ai-supabase-help__summary) {
    padding: 0 16px 16px;
}

.ai-supabase-help__hint {
    color: #646970;
    font-weight: 400;
    margin-left: 8px;
    font-size: 13px;
}

/* ==========================================================================
   Sold Count Update
   ========================================================================== */

.aivesese-sold-count {
    margin: 20px 0;
    padding: 16px 18px;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    background: #fff;
}

.aivesese-sold-count-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 0;
}

.aivesese-sold-count-status {
    margin-top: 10px;
}

/* ==========================================================================
   Setup Flow
   ========================================================================== */

.setup-flow {
    margin: 20px 0;
}

.setup-step {
    margin: 25px 0;
    padding: 20px;
    background: #fafafa;
    border-left: 4px solid #0073aa;
    border-radius: 0 8px 8px 0;
}

.setup-step h3 {
    margin-top: 0;
    color: #0073aa;
    font-size: 18px;
}

.setup-step ol,
.setup-step ul {
    margin: 15px 0;
    padding-left: 20px;
}

.setup-step li {
    margin: 8px 0;
    line-height: 1.5;
}

.setup-step code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #ddd;
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
}

.setup-step .notice {
    margin: 15px 0;
}

.setup-step .notice.inline {
    display: block;
    padding: 15px;
    border-left: 4px solid;
    border-radius: 0 4px 4px 0;
}

.setup-step .notice.notice-info {
    background: #e8f4fd;
    border-left-color: #0073aa;
}

.setup-step .notice.notice-warning {
    background: #fff3cd;
    border-left-color: #ffb900;
}

/* ==========================================================================
   Services Banner
   ========================================================================== */

.aivesese-services-banner {
    display: flex !important;
    align-items: center;
    gap: 16px;
    border-left: 6px solid #673ab7 !important;
    background: #f5f3ff !important;
    padding: 14px 18px;
    margin-top: 16px;
}

.aivesese-services-banner>div:first-child {
    font-size: 24px;
}

.aivesese-services-banner>div:nth-child(2) {
    flex: 1 1 auto;
}

.aivesese-services-banner strong {
    color: #673ab7;
}

/* ==========================================================================
   Welcome Notice
   ========================================================================== */

.aivesese-welcome-notice {
    border-left: 4px solid #0073aa !important;
    background: #f0f8ff !important;
}

.aivesese-welcome-notice h3 {
    color: #0073aa;
    margin-top: 0;
}

.aivesese-welcome-notice .connection-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 15px 0;
}

.aivesese-welcome-notice .connection-cards>div {
    padding: 15px;
    border: 2px solid;
    border-radius: 8px;
}

.aivesese-welcome-notice .connection-cards h4 {
    margin-top: 0;
    font-size: 16px;
}

.aivesese-welcome-notice .connection-cards ul {
    margin: 10px 0;
    padding-left: 20px;
}

.aivesese-welcome-notice .connection-cards li {
    margin: 8px 0;
    font-size: 14px;
}

/* ==========================================================================
   Status Page Elements
   ========================================================================== */

.aivs-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.aivs-stat-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.aivs-stat-card h3 {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.aivs-stat-number {
    font-size: 28px;
    font-weight: bold;
    color: #0073aa;
    margin: 10px 0;
}

.aivs-stat-good {
    color: #46b450;
}

.aivs-stat-okay {
    color: #ffb900;
}

.aivs-stat-poor {
    color: #dc3232;
}

.aivs-stat-card small {
    color: #666;
    font-size: 12px;
}

/* ==========================================================================
   Usage Bars
   ========================================================================== */

.usage-bars {
    margin: 20px 0;
}

.usage-bar-container {
    margin: 15px 0;
}

.usage-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 14px;
}

.usage-bar-header span:first-child {
    font-weight: 600;
    color: #1d2327;
}

.usage-bar-header span:last-child {
    color: #646970;
    font-size: 13px;
}

.usage-bar {
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.usage-bar-fill {
    height: 100%;
    background-color: #10b981;
    transition: width 0.3s ease;
    border-radius: 10px;
}

/* ==========================================================================
   Quick Actions
   ========================================================================== */

.quick-actions {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.quick-actions h2 {
    margin-top: 0;
    color: #1d2327;
}

.quick-actions p {
    margin-bottom: 0;
}

.quick-actions .button {
    margin-right: 10px;
    margin-bottom: 10px;
}

/* ==========================================================================
   Sync Actions
   ========================================================================== */

.sync-actions .card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sync-actions .card h3 {
    margin-top: 0;
    color: #1d2327;
}

.sync-actions .card p {
    color: #646970;
    margin: 10px 0;
}

.sync-actions .card form {
    margin-top: 15px;
}

.sync-actions .card label {
    margin-right: 15px;
    font-weight: 500;
}

.sync-actions .card input[type="number"] {
    width: 80px;
    margin: 0 5px;
}

.aivesese-sync-progress {
    margin: 12px 0 4px;
}

.aivesese-progress-bar-wrap {
    background: #e0e0e0;
    border-radius: 4px;
    height: 16px;
    overflow: hidden;
}

.aivesese-progress-bar {
    height: 100%;
    width: 0;
    background: #2271b1;
    border-radius: 4px;
    transition: width 0.4s ease;
}

.aivesese-progress-bar.is-done {
    background: #00a32a;
}

.aivesese-progress-label {
    margin: 6px 0 0;
    color: #646970;
    font-size: 13px;
}

.aivesese-progress-label.is-done {
    color: #00a32a;
    font-weight: 600;
}

/* ==========================================================================
   Configuration Summary
   ========================================================================== */

.configuration-summary table th,
.configuration-summary table td {
    padding: 10px 15px;
    text-align: left;
}

.configuration-summary table th {
    background: #f8f9fa;
    font-weight: 600;
    border-bottom: 2px solid #e1e5e9;
}

.configuration-summary table code {
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    word-break: break-all;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .connection-mode-selector {
        grid-template-columns: 1fr;
    }

    .aivesese-welcome-notice .connection-cards {
        grid-template-columns: 1fr;
    }

    .aivs-stats-grid {
        grid-template-columns: 1fr;
    }

    .usage-bar-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

@media (max-width: 600px) {
    .option-card {
        padding: 15px;
    }

    .setup-step {
        padding: 15px;
    }

    .license-key-section {
        max-width: 100%;
    }
}

/* ==========================================================================
   WordPress Admin Compatibility
   ========================================================================== */

.aivesese-admin .notice {
    margin: 15px 0;
}

.aivesese-admin .button-large {
    font-size: 16px;
    padding: 12px 24px;
    height: auto;
}

.aivesese-admin .regular-text {
    width: 400px;
}

@media (max-width: 768px) {
    .aivesese-admin .regular-text {
        width: 100%;
        max-width: 400px;
    }
}

/* ==========================================================================
   Plugin Mode Specific Styles
   ========================================================================== */

.aivesese-mode-api .self-hosted-only {
    display: none !important;
}

.aivesese-mode-self_hosted .api-only {
    display: none !important;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.aivesese-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #646970;
}

.aivesese-loading .dashicons {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.aivesese-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
}

.aivesese-empty-state h3 {
    color: #1d2327;
    margin-bottom: 10px;
}

.aivesese-empty-state .dashicons {
    font-size: 48px;
    color: #c3c4c7;
    margin-bottom: 20px;
}

/* ==========================================================================
   Success/Error States
   ========================================================================== */

.aivesese-success {
    color: #00a32a;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 4px;
    padding: 10px 15px;
}

.aivesese-error {
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    padding: 10px 15px;
}

.aivesese-warning {
    color: #f59e0b;
    background: #fffbf0;
    border: 1px solid #fed7aa;
    border-radius: 4px;
    padding: 10px 15px;
}

.aivesese-info {
    color: #0073aa;
    background: #e8f4fd;
    border: 1px solid #7dd3fc;
    border-radius: 4px;
    padding: 10px 15px;
}

/* ==========================================================================
   Connection Mode Help Section - "Need Help Choosing?"
   ========================================================================== */

.connection-mode-help {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 24px;
    margin: 40px 0 30px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    clear: both;
    position: relative;
    z-index: 1;
}

.connection-mode-help h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #1d2327;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.help-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 20px;
}

.comparison-item {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.comparison-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.comparison-item strong {
    display: block;
    margin-bottom: 15px;
    color: #0073aa;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #e1e5e9;
    padding-bottom: 8px;
}

.comparison-item ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.comparison-item li {
    margin: 10px 0;
    padding-left: 20px;
    position: relative;
    color: #646970;
    font-size: 14px;
    line-height: 1.5;
}

.comparison-item li:before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 0;
    color: #46b450;
    font-weight: bold;
    font-size: 16px;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
    .help-comparison {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .connection-mode-help {
        padding: 20px;
        margin: 20px 0;
    }

    .comparison-item {
        padding: 16px;
    }
}

/* ==========================================================================
   Disabled Connection Option (Coming Soon)
   ========================================================================== */

.connection-option-disabled {
    cursor: not-allowed;
    opacity: 0.7;
    position: relative;
}

.connection-option-disabled .api-service-preview {
    background: rgba(255, 255, 255, 0.5);
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    height: 100%;
    box-sizing: border-box;
    pointer-events: none;
    /* Completely disable clicking */
    transition: none;
    /* Remove any hover effects */
}

.connection-option-disabled .api-service-preview h5 {
    margin: 0 0 12px 0;
    color: #999;
    font-size: 18px;
    font-weight: 600;
}

.connection-option-disabled .api-service-preview p {
    margin: 0;
    color: #777;
    font-style: italic;
    font-size: 14px;
}

/* Add a subtle "disabled" overlay effect */
.connection-option-disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    pointer-events: none;
}

/* Ensure no hover effects on disabled option */
.connection-option-disabled:hover .api-service-preview {
    transform: none;
    box-shadow: none;
    border-color: #ccc;
}

/* Make sure the grid layout still works properly */
.connection-mode-selector .connection-option-disabled {
    display: flex;
    flex-direction: column;
}

.upgrade-option-card.premium {
    display: none;
}

/* ==========================================================================
   Setup Instructions
   ========================================================================== */

.setup-flow {
    margin: 20px 0;
}

.setup-step {
    margin: 25px 0;
    padding: 20px;
    background: #fafafa;
    border-left: 4px solid #0073aa;
    border-radius: 0 8px 8px 0;
}

.setup-step h3 {
    margin-top: 0;
    color: #0073aa;
}

.setup-step code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #ddd;
}

.setup-notice {
    margin: 15px 0;
}

.setup-cli-list {
    margin: 10px 0 0 20px;
    list-style: disc;
}

.setup-cli-list li {
    margin: 4px 0;
}
