/**
 * CroPilot WordPress Plugin Admin Styles
 * Modern card-based design system
 */

/* CSS Custom Properties */
:root {
    --cropilot-primary: #7c3aed;
    --cropilot-primary-dark: #5b21b6;
    --cropilot-primary-light: #8b5cf6;
    --cropilot-success: #10b981;
    --cropilot-success-light: #d1fae5;
    --cropilot-warning: #f59e0b;
    --cropilot-warning-light: #fef3c7;
    --cropilot-danger: #ef4444;
    --cropilot-danger-light: #fee2e2;
    --cropilot-gray-50: #f9fafb;
    --cropilot-gray-100: #f3f4f6;
    --cropilot-gray-200: #e5e7eb;
    --cropilot-gray-300: #d1d5db;
    --cropilot-gray-400: #9ca3af;
    --cropilot-gray-500: #6b7280;
    --cropilot-gray-600: #4b5563;
    --cropilot-gray-700: #374151;
    --cropilot-gray-800: #1f2937;
    --cropilot-gray-900: #111827;
    --cropilot-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --cropilot-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --cropilot-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --cropilot-radius: 12px;
    --cropilot-radius-sm: 8px;
}

/* Main wrapper */
.cropilot-admin-wrap {
    max-width: 820px;
    margin: 20px 20px 20px 2px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Header */
.cropilot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--cropilot-gray-200);
}

.cropilot-logo {
    max-width: 180px;
    height: auto;
}

.cropilot-dashboard-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--cropilot-primary);
    color: white !important;
    text-decoration: none;
    border-radius: var(--cropilot-radius-sm);
    font-weight: 500;
    font-size: 14px;
    transition: background 0.2s ease, transform 0.1s ease;
}

.cropilot-dashboard-link:hover {
    background: var(--cropilot-primary-dark);
    color: white !important;
    transform: translateY(-1px);
}

.cropilot-dashboard-link .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Card base styles */
.cropilot-card {
    background: #fff;
    border-radius: var(--cropilot-radius);
    box-shadow: var(--cropilot-shadow);
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid var(--cropilot-gray-200);
}

.cropilot-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--cropilot-gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--cropilot-gray-50);
}

.cropilot-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--cropilot-gray-900);
}

.cropilot-card-title .dashicons {
    color: var(--cropilot-primary);
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.cropilot-card-body {
    padding: 20px;
}

/* Status Card Specific */
.cropilot-status-card .cropilot-card-header {
    background: linear-gradient(135deg, var(--cropilot-primary) 0%, var(--cropilot-primary-dark) 100%);
    border-bottom: none;
}

.cropilot-status-card .cropilot-card-title {
    color: white;
}

.cropilot-status-card .cropilot-card-title .dashicons {
    color: white;
}

/* Plan Badge */
.cropilot-plan-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cropilot-plan-badge.plan-free {
    background: var(--cropilot-gray-500);
}

.cropilot-plan-badge.plan-starter {
    background: var(--cropilot-primary);
}

.cropilot-plan-badge.plan-professional {
    background: var(--cropilot-success);
}

.cropilot-plan-badge.plan-agency {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Progress bar */
.cropilot-progress-section {
    margin-bottom: 16px;
}

.cropilot-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--cropilot-gray-600);
}

.cropilot-progress-value {
    font-weight: 600;
    color: var(--cropilot-gray-900);
}

.cropilot-progress-bar {
    height: 10px;
    background: var(--cropilot-gray-200);
    border-radius: 5px;
    overflow: hidden;
}

.cropilot-progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, var(--cropilot-primary) 0%, var(--cropilot-primary-light) 100%);
}

.cropilot-progress-fill.status-good {
    background: linear-gradient(90deg, var(--cropilot-success) 0%, #34d399 100%);
}

.cropilot-progress-fill.status-warning {
    background: linear-gradient(90deg, var(--cropilot-warning) 0%, #fbbf24 100%);
}

.cropilot-progress-fill.status-danger {
    background: linear-gradient(90deg, var(--cropilot-danger) 0%, #f87171 100%);
}

/* Status meta info */
.cropilot-status-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--cropilot-gray-200);
    margin-top: 16px;
}

.cropilot-status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.cropilot-status-item label {
    color: var(--cropilot-gray-500);
    font-weight: 400;
}

.cropilot-status-item span {
    color: var(--cropilot-gray-900);
    font-weight: 500;
}

.cropilot-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cropilot-success);
}

.cropilot-status-dot.status-trialing {
    background: var(--cropilot-primary);
}

.cropilot-status-dot.status-past_due {
    background: var(--cropilot-warning);
}

.cropilot-status-dot.status-canceled,
.cropilot-status-dot.status-unpaid {
    background: var(--cropilot-danger);
}

/* Status Error */
.cropilot-status-error {
    display: none;
    padding: 16px;
    background: var(--cropilot-danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: var(--cropilot-radius-sm);
    font-size: 14px;
    line-height: 1.6;
}

.cropilot-status-error.show {
    display: block;
}

.cropilot-status-error .dashicons {
    color: var(--cropilot-danger);
    margin-right: 6px;
    vertical-align: middle;
}

.cropilot-status-error strong {
    display: block;
    font-size: 15px;
    margin-bottom: 6px;
    color: #7f1d1d;
}

/* Upgrade Card */
.cropilot-upgrade-card {
    background: linear-gradient(135deg, var(--cropilot-primary) 0%, #4c1d95 100%);
    border: none;
}

.cropilot-upgrade-card .cropilot-card-header {
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.cropilot-upgrade-card .cropilot-card-title {
    color: white;
}

.cropilot-upgrade-card .cropilot-card-title .dashicons {
    color: #fbbf24;
}

.cropilot-upgrade-card .cropilot-card-body {
    color: white;
}

.cropilot-upgrade-intro {
    font-size: 15px;
    margin-bottom: 16px;
    opacity: 0.95;
}

.cropilot-upgrade-benefits {
    list-style: none;
    margin: 0 0 20px 0;
    padding: 0;
}

.cropilot-upgrade-benefits li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 14px;
}

.cropilot-upgrade-benefits li .dashicons {
    color: #34d399;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.cropilot-upgrade-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: white;
    color: var(--cropilot-primary) !important;
    text-decoration: none;
    border-radius: var(--cropilot-radius-sm);
    font-weight: 600;
    font-size: 15px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cropilot-upgrade-cta:hover {
    transform: translateY(-2px);
    box-shadow: var(--cropilot-shadow-lg);
    color: var(--cropilot-primary-dark) !important;
}

/* Settings Card */
.cropilot-settings-card .cropilot-card-body {
    padding: 0;
}

.cropilot-form-section {
    padding: 20px;
    border-bottom: 1px solid var(--cropilot-gray-200);
}

.cropilot-form-section:last-child {
    border-bottom: none;
}

.cropilot-form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--cropilot-gray-700);
    margin: 0 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cropilot-form-group {
    margin-bottom: 16px;
}

.cropilot-form-group:last-child {
    margin-bottom: 0;
}

.cropilot-form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--cropilot-gray-700);
    margin-bottom: 6px;
}

.cropilot-form-input {
    width: 100%;
    max-width: 300px;
    padding: 10px 14px;
    border: 1px solid var(--cropilot-gray-300);
    border-radius: var(--cropilot-radius-sm);
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cropilot-form-input:focus {
    outline: none;
    border-color: var(--cropilot-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.cropilot-form-description {
    margin-top: 6px;
    font-size: 13px;
    color: var(--cropilot-gray-500);
}

/* Inline input with button */
.cropilot-input-group {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.cropilot-input-group .cropilot-form-input {
    flex: 1;
}

/* Checkbox toggle */
.cropilot-checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cropilot-checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 2px 0 0 0;
    cursor: pointer;
    accent-color: var(--cropilot-primary);
}

.cropilot-checkbox-label {
    flex: 1;
}

.cropilot-checkbox-label .label-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--cropilot-gray-700);
    display: block;
    margin-bottom: 2px;
}

.cropilot-checkbox-label .label-description {
    font-size: 13px;
    color: var(--cropilot-gray-500);
}

/* Buttons */
.cropilot-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--cropilot-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.cropilot-btn-primary {
    background: var(--cropilot-primary);
    color: white;
}

.cropilot-btn-primary:hover {
    background: var(--cropilot-primary-dark);
    color: white;
}

.cropilot-btn-secondary {
    background: var(--cropilot-gray-100);
    color: var(--cropilot-gray-700);
    border: 1px solid var(--cropilot-gray-300);
}

.cropilot-btn-secondary:hover {
    background: var(--cropilot-gray-200);
    color: var(--cropilot-gray-900);
}

.cropilot-btn-success {
    background: var(--cropilot-success);
    color: white;
}

.cropilot-btn-success:hover {
    background: #059669;
    color: white;
}

.cropilot-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Form actions */
.cropilot-form-actions {
    display: flex;
    gap: 12px;
    padding: 20px;
    background: var(--cropilot-gray-50);
    border-top: 1px solid var(--cropilot-gray-200);
}

/* Connection status */
.cropilot-connection-status {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: var(--cropilot-radius-sm);
    font-size: 14px;
    display: none;
}

.cropilot-connection-status.show {
    display: block;
}

.cropilot-connection-status.success {
    background: var(--cropilot-success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.cropilot-connection-status.error {
    background: var(--cropilot-danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Quick Start Card */
.cropilot-quickstart-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: step-counter;
}

.cropilot-quickstart-list li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--cropilot-gray-100);
    counter-increment: step-counter;
}

.cropilot-quickstart-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cropilot-quickstart-list li::before {
    content: counter(step-counter);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: var(--cropilot-primary);
    color: white;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 600;
}

.cropilot-quickstart-text {
    font-size: 14px;
    color: var(--cropilot-gray-700);
    line-height: 1.5;
    padding-top: 4px;
}

.cropilot-quickstart-text a {
    color: var(--cropilot-primary);
    text-decoration: none;
    font-weight: 500;
}

.cropilot-quickstart-text a:hover {
    text-decoration: underline;
}

/* Help links */
.cropilot-help-links {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--cropilot-gray-200);
}

.cropilot-help-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--cropilot-gray-100);
    color: var(--cropilot-gray-700) !important;
    text-decoration: none;
    border-radius: var(--cropilot-radius-sm);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.cropilot-help-link:hover {
    background: var(--cropilot-gray-200);
    color: var(--cropilot-gray-900) !important;
}

.cropilot-help-link .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* WooCommerce Notice */
.cropilot-woo-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 20px;
    border-radius: var(--cropilot-radius-sm);
    font-size: 14px;
}

.cropilot-woo-notice.notice-success {
    background: var(--cropilot-success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.cropilot-woo-notice.notice-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.cropilot-woo-notice .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.cropilot-woo-notice strong {
    font-weight: 600;
}

/* Loading skeleton */
.cropilot-skeleton {
    background: linear-gradient(90deg, var(--cropilot-gray-200) 25%, var(--cropilot-gray-100) 50%, var(--cropilot-gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.cropilot-skeleton-text {
    height: 16px;
    width: 60%;
    margin-bottom: 8px;
}

.cropilot-skeleton-bar {
    height: 10px;
    width: 100%;
}

/* Hidden utility */
.cropilot-hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 782px) {
    .cropilot-admin-wrap {
        margin: 10px;
    }

    .cropilot-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .cropilot-input-group {
        flex-direction: column;
    }

    .cropilot-input-group .cropilot-form-input {
        max-width: 100%;
    }

    .cropilot-status-meta {
        flex-direction: column;
        gap: 12px;
    }

    .cropilot-help-links {
        flex-direction: column;
    }

    .cropilot-form-actions {
        flex-direction: column;
    }
}
