/**
 * Barika Co-Marketing Admin Styles
 * Professional branded design for WordPress admin
 */

/* ========================================
   Header & Branding
   ======================================== */

.barika-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.barika-header-logo {
    height: 80px;
    width: auto;
}

.barika-header-title {
    font-size: 1.5em;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.barika-header-subtitle {
    font-size: 0.875em;
    color: #6b7280;
    margin: 4px 0 0 0;
}

/* ========================================
   Main Container
   ======================================== */

.barika-settings-wrap {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 20px;
}

/* ========================================
   Cards
   ======================================== */

.barika-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.2s ease;
}

.barika-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.barika-info-card {
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 24px;
}

.barika-info-card h2 {
    margin: 0 0 12px 0;
    font-size: 1.1em;
    font-weight: 600;
    color: #111827;
}

.barika-info-card > p:first-of-type {
    color: #4b5563;
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.barika-info-card ul {
    margin: 16px 0 0 0;
    padding-left: 0;
    list-style: none;
}

.barika-info-card li {
    margin-bottom: 10px;
    color: #4b5563;
    padding-left: 24px;
    position: relative;
    line-height: 1.5;
}

.barika-info-card li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: 600;
}

.barika-info-card a {
    color: #111827;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.barika-info-card a:hover {
    text-decoration: underline;
}

/* ========================================
   Status Indicators
   ======================================== */

.barika-status {
    display: flex;
    align-items: center;
    font-size: 1em;
    font-weight: 600;
    margin-bottom: 20px;
    padding: 12px 16px;
    border-radius: 8px;
}

.barika-status-connected {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: #065f46;
}

.barika-status-disconnected {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    color: #991b1b;
}

.barika-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}

.barika-status-connected .barika-status-indicator {
    background-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.barika-status-disconnected .barika-status-indicator {
    background-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* ========================================
   Connection Info
   ======================================== */

.barika-connection-info {
    margin: 20px 0;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.barika-connection-info p {
    margin: 8px 0;
    color: #374151;
    font-size: 0.925em;
}

.barika-connection-info p strong {
    color: #111827;
}

/* ========================================
   Webhook Status
   ======================================== */

.barika-webhooks-status {
    margin: 24px 0;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.barika-webhooks-status h3 {
    font-size: 0.925em;
    font-weight: 600;
    color: #111827;
    margin: 0 0 12px 0;
}

.barika-webhooks-status ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.barika-webhooks-status li {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.85em;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
}

.barika-webhook-active {
    color: #10b981;
    margin-right: 6px;
}

.barika-webhook-inactive {
    color: #f59e0b;
    margin-right: 6px;
}

.barika-webhook-missing {
    color: #ef4444;
    margin-right: 6px;
}

/* ========================================
   Actions
   ======================================== */

.barika-actions {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.barika-actions .button {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.barika-actions .button-primary {
    background: #111827;
    border-color: #111827;
    color: #fff;
}

.barika-actions .button-primary:hover {
    background: #1f2937;
    border-color: #1f2937;
}

.barika-disconnect-btn {
    color: #dc2626 !important;
    border-color: #fca5a5 !important;
    background: #fef2f2 !important;
}

.barika-disconnect-btn:hover {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #fff !important;
}

/* ========================================
   Connect Prompt (Disconnected State)
   ======================================== */

.barika-connect-prompt {
    text-align: center;
    padding: 32px 20px;
}

.barika-connect-prompt > p:first-child {
    font-size: 1.1em;
    color: #4b5563;
    margin: 0 0 28px 0;
    line-height: 1.6;
}

.barika-connect-steps {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 20px 28px;
    margin: 0 auto 28px auto;
    max-width: 380px;
    text-align: left;
}

.barika-connect-steps ol {
    margin: 0;
    padding-left: 24px;
    counter-reset: step-counter;
    list-style: none;
}

.barika-connect-steps li {
    padding: 8px 0;
    color: #1e40af;
    position: relative;
    padding-left: 8px;
    counter-increment: step-counter;
}

.barika-connect-steps li::before {
    content: counter(step-counter) ".";
    font-weight: 600;
    position: absolute;
    left: -24px;
}

#barika-connect {
    background: #111827;
    border-color: #111827;
    color: #fff;
    padding: 14px 48px;
    font-size: 1em;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

#barika-connect:hover {
    background: #1f2937;
    border-color: #1f2937;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(17, 24, 39, 0.25);
}

/* ========================================
   ESP Section
   ======================================== */

.barika-esp-section {
    border-left: 4px solid #10b981 !important;
}

.barika-esp-section h3 {
    margin: 0 0 12px 0;
    font-size: 1em;
    font-weight: 600;
    color: #111827;
}

.barika-native-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.barika-esp-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.barika-esp-buttons .button {
    border-radius: 6px;
}

/* ========================================
   Loading States
   ======================================== */

.barika-loading {
    opacity: 0.6;
    pointer-events: none;
}

.barika-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #111827;
    border-radius: 50%;
    animation: barika-spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* ========================================
   Developer Settings (Hidden by Default)
   ======================================== */

.barika-dev-settings {
    background: #fffbeb !important;
    border-left: 4px solid #f59e0b !important;
}

.barika-dev-settings h3 {
    color: #92400e;
    margin: 0 0 8px 0;
}

/* ========================================
   Modal Styles
   ======================================== */

#barika-modal-container {
    display: none;
}

#barika-modal-container.active {
    display: block;
}

.barika-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.barika-modal-content {
    background: #fff;
    border-radius: 16px;
    max-width: 480px;
    width: 100%;
    padding: 32px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    animation: barika-modal-appear 0.2s ease-out;
}

@keyframes barika-modal-appear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.barika-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f3f4f6;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #6b7280;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.barika-modal-close:hover {
    background: #e5e7eb;
    color: #111827;
}

.barika-modal-icon {
    margin-bottom: 16px;
}

.barika-modal-title {
    margin: 0 0 16px 0;
    font-size: 1.25em;
    font-weight: 600;
    color: #111827;
}

.barika-modal-body {
    color: #4b5563;
    line-height: 1.6;
}

.barika-modal-body ul {
    margin: 15px 0;
    padding-left: 20px;
    text-align: left;
}

.barika-modal-body li {
    margin-bottom: 8px;
}

.barika-modal-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.barika-modal-actions .button {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 500;
}

body.barika-modal-open {
    overflow: hidden;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 600px) {
    .barika-settings-wrap {
        padding: 0 12px;
    }
    
    .barika-card,
    .barika-info-card {
        padding: 20px;
    }
    
    .barika-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .barika-actions {
        flex-direction: column;
    }
    
    .barika-actions .button {
        width: 100%;
        text-align: center;
    }
    
    .barika-webhooks-status ul {
        flex-direction: column;
    }
}
