/* Connections Page Styles */

/* Header Title in Dashboard Header */
.header-title h1 {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

/* Connections Header */
.connections-header {
    margin-bottom: 24px;
}

.connections-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px 0;
}

.connections-header p {
    font-size: 15px;
    color: var(--gray-400);
    margin: 0;
}

/* Connection Limit Banner */
.connection-limit-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 12px;
    margin-bottom: 24px;
}

.limit-icon {
    width: 40px;
    height: 40px;
    background: rgba(251, 191, 36, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fbbf24;
    flex-shrink: 0;
}

.limit-text {
    flex: 1;
}

.limit-text strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #fbbf24;
    margin-bottom: 2px;
}

.limit-text p {
    font-size: 13px;
    color: var(--gray-400);
    margin: 0;
}

/* Connections Section */
.connections-section {
    background: rgba(17, 24, 39, 0.5);
    border: 1px solid var(--gray-800);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.connections-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.connections-section .section-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

/* Sites/Projects Grid */
.sites-grid,
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* Site Card */
.site-card {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.site-card:hover {
    border-color: rgba(239, 68, 68, 0.3);
    transform: translateY(-2px);
}

.site-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--gray-700);
}

.site-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #21759b 0%, #1e6a8d 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.site-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
}

.site-status.connected {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.site-status.disconnected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red-400);
}

/* Site Card Badges Container */
.site-card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Subscription Status Badge */
.subscription-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.subscription-status.status-active {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.subscription-status.status-trialing {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.subscription-status.status-past-due {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.subscription-status.status-cancelled {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.subscription-status.status-incomplete {
    background: rgba(249, 115, 22, 0.15);
    color: #f97316;
}

.subscription-status.status-unknown {
    background: rgba(107, 114, 128, 0.15);
    color: #9ca3af;
}

.site-card-body {
    padding: 16px;
}

.site-card-body .site-name {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 4px 0;
}

.site-card-body .site-url {
    font-size: 13px;
    color: var(--gray-400);
    margin: 0 0 8px 0;
    word-break: break-all;
}

.site-card-body .site-connected-at {
    font-size: 12px;
    color: var(--gray-500);
    margin: 0;
}

.site-card-footer {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--gray-700);
    background: rgba(0, 0, 0, 0.1);
}

/* Site Card License Key Section */
.site-card-license {
    border-top: 1px solid var(--gray-700);
    background: rgba(0, 0, 0, 0.15);
}

.site-card-license .license-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    cursor: pointer;
    color: var(--gray-400);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.site-card-license .license-toggle:hover {
    color: var(--gray-300);
    background: rgba(255, 255, 255, 0.02);
}

.site-card-license .license-toggle .chevron {
    margin-left: auto;
    transition: transform 0.2s ease;
}

.site-card-license.expanded .license-toggle .chevron {
    transform: rotate(180deg);
}

.site-card-license .license-key-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 12px 16px;
}

.site-card-license .license-key-value {
    flex: 1;
    background: var(--gray-900);
    border: 1px solid var(--gray-700);
    border-radius: 6px;
    padding: 8px 12px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 11px;
    color: #22c55e;
    word-break: break-all;
    user-select: all;
}

.site-card-license .btn-copy-key {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    color: var(--gray-400);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-card-license .btn-copy-key:hover {
    background: var(--gray-700);
    color: #fff;
    border-color: var(--gray-600);
}

.site-card-license .btn-copy-key.copied {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.site-card-license .btn-regenerate-key {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    color: var(--gray-400);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-card-license .btn-regenerate-key:hover {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.3);
}

/* Empty State */
.empty-state {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
}

.empty-state .empty-icon {
    width: 80px;
    height: 80px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--red-400);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 8px 0;
}

.empty-state p {
    font-size: 14px;
    color: var(--gray-400);
    margin: 0 0 20px 0;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--red-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.loading-state p {
    font-size: 14px;
    color: var(--gray-500);
    margin: 0;
}

/* Setup Section */
.setup-section {
    background: rgba(17, 24, 39, 0.3);
    border: 1px dashed var(--gray-700);
}

.setup-steps {
    display: flex;
    gap: 16px;
}

.setup-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.step-number {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--red-500), var(--red-600));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.step-content h4 {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 6px 0;
}

.step-content p {
    font-size: 13px;
    color: var(--gray-400);
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.step-divider {
    width: 1px;
    background: var(--gray-700);
    flex-shrink: 0;
}

/* License Key Box */
.license-key-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.license-key-display {
    background: var(--gray-800);
    border: 1px solid var(--gray-700);
    border-radius: 8px;
    padding: 14px 16px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
}

.license-key-display .no-key {
    color: var(--gray-500);
    font-style: italic;
    font-family: 'Inter', sans-serif;
}

.license-key-display .key {
    color: #22c55e;
    word-break: break-all;
    user-select: all;
}

.license-key-actions {
    display: flex;
    gap: 8px;
}

/* Button Variants */
.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--gray-700);
    color: var(--gray-400);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-danger-outline:hover {
    border-color: rgba(239, 68, 68, 0.5);
    color: var(--red-400);
    background: rgba(239, 68, 68, 0.1);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
}

.modal-content {
    position: relative;
    background: var(--gray-900, #111827);
    border: 1px solid var(--gray-700, #374151);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-800, #1f2937);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--gray-400, #9ca3af);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 24px;
}

.modal-body .form-group {
    margin-bottom: 20px;
}

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

.modal-body .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-300, #d1d5db);
    margin-bottom: 8px;
}

.modal-body .form-input {
    width: 100%;
    background: var(--gray-800, #1f2937);
    border: 1px solid var(--gray-700, #374151);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    color: #fff;
    transition: all 0.2s ease;
}

.modal-body .form-input:focus {
    outline: none;
    border-color: var(--red-500, #ef4444);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.modal-body .form-input::placeholder {
    color: var(--gray-500, #6b7280);
}

.modal-body .form-textarea {
    width: 100%;
    background: var(--gray-800, #1f2937);
    border: 1px solid var(--gray-700, #374151);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    color: #fff;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: all 0.2s ease;
}

.modal-body .form-textarea:focus {
    outline: none;
    border-color: var(--red-500, #ef4444);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.modal-body .form-textarea::placeholder {
    color: var(--gray-500, #6b7280);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-800, #1f2937);
    background: rgba(0, 0, 0, 0.2);
}

.modal-footer .btn-secondary {
    background: transparent;
    border: 1px solid var(--gray-700, #374151);
    color: var(--gray-300, #d1d5db);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-footer .btn-secondary:hover {
    background: var(--gray-800, #1f2937);
    border-color: var(--gray-600, #4b5563);
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, var(--red-500, #ef4444), var(--red-600, #dc2626));
    border: none;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-footer .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.modal-footer .btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Setup Status Badge (Analyzing state) */
.setup-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.setup-status.status-analyzing {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.setup-status .status-spinner {
    width: 10px;
    height: 10px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Button spinner for inline loading states */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

/* WordPress Connection Status Badge */
.wp-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
}

.wp-status.wp-connected {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

.wp-status.wp-pending {
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
}

.wp-status.wp-not-connected {
    background: rgba(107, 114, 128, 0.12);
    color: #9ca3af;
}

/* Site Card WordPress Status Section */
.site-card-wp-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--gray-700);
}

/* Extra small button variant */
.btn.btn-xs {
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 6px;
}

.btn.connect-wp-btn {
    gap: 4px;
}

.btn.connect-wp-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--red-400);
}

/* Highlight animation for WP setup section */
.setup-section.highlight-section {
    animation: highlightPulse 0.5s ease-out;
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
}

@keyframes highlightPulse {
    0% {
        border-color: rgba(239, 68, 68, 0.8);
        box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
    }
    100% {
        border-color: rgba(239, 68, 68, 0.5);
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 1024px) {
    .setup-steps {
        flex-direction: column;
    }

    .step-divider {
        width: 100%;
        height: 1px;
    }
}

@media (max-width: 768px) {
    .connections-header h2 {
        font-size: 20px;
    }

    .connection-limit-banner {
        flex-direction: column;
        text-align: center;
    }

    .limit-text {
        text-align: center;
    }

    .connections-section {
        padding: 16px;
    }

    .sites-grid {
        grid-template-columns: 1fr;
    }

    .site-card-wp-status {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .site-card-wp-status .btn {
        width: 100%;
        justify-content: center;
    }

    .site-card-footer {
        flex-direction: column;
    }

    .site-card-footer .btn {
        width: 100%;
        justify-content: center;
    }
}
