/* WordPress Manager Portal Styles */

.wp-portal-container {
    min-height: 100vh;
    background: #f8f9fa;
}

/* Portal Header */
.portal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.portal-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.portal-title i {
    margin-right: 0.5rem;
    color: #ffd700;
}

.portal-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-left: 4px solid #e9ecef;
    display: flex;
    align-items: center;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.stat-card.active {
    border-left-color: #28a745;
}

.stat-card.uptime {
    border-left-color: #17a2b8;
}

.stat-icon {
    background: #f8f9fa;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.2rem;
    color: #667eea;
}

.stat-card.active .stat-icon {
    background: #28a745;
    color: white;
}

.stat-card.uptime .stat-icon {
    background: #17a2b8;
    color: white;
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #333;
}

.stat-content p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.card-header {
    background: white;
    border-bottom: 2px solid #f8f9fa;
    border-radius: 12px 12px 0 0 !important;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h4 {
    margin: 0;
    font-weight: 600;
    color: #333;
}

.card-header h4 i {
    margin-right: 0.5rem;
    color: #667eea;
}

.card-actions .btn {
    border-radius: 6px;
}

/* Sites List */
.sites-list {
    max-height: 600px;
    overflow-y: auto;
}

.site-item {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: #fafbfc;
    transition: all 0.3s ease;
}

.site-item:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

/* Unified Portal Dashboard */
.portal-dashboard {
    background: #f8f9fb;
    padding: 2.5rem 0 4rem;
}

.portal-section {
    margin-bottom: 2.5rem;
}

.portal-section--stats .wp-stats-grid {
    margin-bottom: 0;
}

.portal-section__header {
    margin-bottom: 1.25rem;
}

.portal-section__header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.portal-section__subtitle {
    color: #6c757d;
    margin: 0;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.quick-action-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #fff;
    border-radius: 14px;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quick-action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.12);
}

.quick-action-card__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #4338ca);
}

.quick-action-card--secondary .quick-action-card__icon {
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
}

.quick-action-card--info .quick-action-card__icon {
    background: linear-gradient(135deg, #10b981, #047857);
}

.quick-action-card--warning .quick-action-card__icon {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.quick-action-card__body h3 {
    font-size: 1.1rem;
    margin: 0 0 0.35rem;
}

.quick-action-card__body p {
    color: #6c757d;
    margin: 0;
}

.quick-action-card__chevron {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: rgba(15, 23, 42, 0.3);
}

.portal-section--grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.portal-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.portal-card__header {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    margin-bottom: 1rem;
}

.portal-card__header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.portal-card__header p {
    margin: 0.15rem 0 0;
    color: #6c757d;
    font-size: 0.9rem;
}

.portal-card__marker {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.portal-card__list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.portal-card__item {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

.portal-card__item:last-child {
    border-bottom: none;
}

.portal-card__empty {
    color: #6c757d;
    padding: 1.5rem;
    text-align: center;
    background: rgba(99, 102, 241, 0.04);
    border-radius: 12px;
}

.item-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.item-title a {
    color: inherit;
    text-decoration: none;
}

.item-meta {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    color: #3730a3;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.status-pill--on {
    background: rgba(16, 185, 129, 0.18);
    color: #047857;
}

.status-pill--off {
    background: rgba(239, 68, 68, 0.18);
    color: #b91c1c;
}

.status-pill--warning {
    background: rgba(245, 158, 11, 0.18);
    color: #b45309;
}

.status-pill--muted {
    background: rgba(148, 163, 184, 0.2);
    color: #475569;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: #475569;
    font-size: 0.75rem;
}

.meta-chip--muted {
    background: rgba(148, 163, 184, 0.18);
    color: #64748b;
}

.portal-card__footer {
    margin-top: 1.25rem;
}

.portal-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.portal-grid--two {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.portal-panel {
    background: #fff;
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.07);
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.portal-panel__header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
}

.portal-panel__header p {
    margin: 0.35rem 0 1rem;
    color: #6c757d;
}

.domain-health-list,
.integration-list,
.activity-feed {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 1rem;
}

.domain-health-item {
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.domain-health-item:last-child {
    border-bottom: none;
}

.domain-health-item__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.6rem;
}

.domain-health-item__foot {
    display: block;
    margin-top: 0.6rem;
    color: #94a3b8;
}

.email-domain-grid {
    display: grid;
    gap: 1rem;
}

.email-domain-card {
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 14px;
    padding: 1.1rem;
    background: rgba(248, 250, 252, 0.7);
}

.email-domain-card header {
    margin-bottom: 0.75rem;
}

.email-domain-card__tags {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-top: 0.4rem;
}

.mailbox-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.5rem;
}

.mailbox-list li {
    display: flex;
    flex-direction: column;
    font-size: 0.9rem;
}

.mailbox-list small {
    color: #94a3b8;
}

.muted {
    color: #94a3b8;
    margin: 0;
}

.routing-rules ul {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    display: grid;
    gap: 0.6rem;
}

.routing-rules li {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px dashed rgba(15, 23, 42, 0.08);
}

.routing-rules li:last-child {
    border-bottom: none;
}

.routing-rules .meta {
    color: #475569;
    font-size: 0.85rem;
}

.integration-list li {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px dashed rgba(15, 23, 42, 0.08);
}

.integration-list li:last-child {
    border-bottom: none;
}

.integration-name {
    font-weight: 600;
}

.integration-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.activity-feed li {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding-bottom: 0.9rem;
    border-bottom: 1px dashed rgba(15, 23, 42, 0.08);
}

.activity-feed li:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4338ca;
}

.activity-body p {
    margin: 0;
    font-weight: 500;
}

.activity-body small {
    color: #94a3b8;
}

.empty-state {
    padding: 1.75rem;
    text-align: center;
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.9);
    border: 1px dashed rgba(99, 102, 241, 0.2);
}

.empty-state p {
    margin-bottom: 1rem;
    color: #64748b;
}

.portal-dashboard--narrow .container {
    max-width: 960px;
}

.portal-checklist {
    margin: 0 0 1rem 1.1rem;
    color: #475569;
}

.portal-checklist li {
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

.test-button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.9rem;
    margin: 1.5rem 0;
}

.portal-test-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(79, 70, 229, 0.32));
    color: #312e81;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.portal-test-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(79, 70, 229, 0.18);
}

.portal-test-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.portal-test-btn--highlight {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(5, 150, 105, 0.32));
    color: #065f46;
}

.portal-test-btn.is-loading {
    pointer-events: none;
}

.test-results {
    margin-top: 1.5rem;
}

.result-block {
    border-radius: 14px;
    padding: 1.35rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(248, 250, 252, 0.9);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
}

.result-block--success {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(209, 250, 229, 0.6);
}

.result-block--error {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(254, 226, 226, 0.6);
}

.result-block__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.result-block__header span {
    font-size: 0.85rem;
    color: rgba(15, 23, 42, 0.7);
}

.result-block ul {
    margin: 0.75rem 0;
    padding-left: 1.1rem;
    color: #374151;
}

.result-block__rules ul,
.result-block__domain ul {
    padding-left: 1.2rem;
    margin: 0.5rem 0;
}

.result-block__rules .meta {
    display: block;
    margin-top: 0.2rem;
    color: #6b7280;
    font-size: 0.85rem;
}

.routing-rules-table {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
}

.routing-rules-row {
    display: grid;
    grid-template-columns: 1.6fr 0.9fr 1.4fr 0.7fr;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    align-items: center;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
}

.routing-rules-row:last-child {
    border-bottom: none;
}

.routing-rules-row--head {
    background: rgba(15, 23, 42, 0.05);
    font-weight: 600;
    color: #1f2937;
}

.routing-rules-row div {
    word-break: break-word;
}

.test-button-grid .portal-test-btn i {
    font-size: 1rem;
}

.test-button-grid .portal-test-btn span {
    display: inline-flex;
    align-items: center;
}

@media (max-width: 640px) {
    .routing-rules-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
}
@media (max-width: 768px) {
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }

    .portal-section--grid {
        grid-template-columns: 1fr;
    }

    .portal-grid--two {
        grid-template-columns: 1fr;
    }
}

.site-name {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.site-name a {
    color: #333;
    text-decoration: none;
}

.site-name a:hover {
    color: #667eea;
}

.site-badges {
    display: flex;
    gap: 0.5rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* WCAG AAA-compliant badge colors (white text on dark backgrounds, ≥7:1 contrast).
 * Bootstrap 4 defaults (#28a745, #dc3545, #17a2b8, #6c757d) only pass AA at ~4.5:1.
 * These darker shades pass AAA contrast (verified via axe-core color-contrast tool).
 *
 * Background hex     | Contrast vs #FFF | WCAG 2 AAA pass?
 * #1c6128 (success)  | 7.52:1           | yes
 * #ffc107 + #212529  | 9.46:1           | yes (kept — yellow needs dark text)
 * #a51d29 (danger)   | 7.47:1           | yes
 * #0c5765 (info)     | 8.18:1           | yes
 * #4d5358 (secondary)| 7.79:1           | yes
 */
.badge-success {
    background: #1c6128;
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #212529;
}

.badge-danger {
    background: #a51d29;
    color: white;
}

.badge-info {
    background: #0c5765;
    color: white;
}

.badge-secondary {
    background: #4d5358;
    color: white;
}

.site-url {
    color: #666;
    margin-bottom: 0.75rem;
}

.site-url i {
    margin-right: 0.5rem;
}

.site-url a {
    color: #667eea;
    text-decoration: none;
}

.site-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.feature-badge {
    background: #e3f2fd;
    color: #1565c0;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.feature-badge.warning {
    background: #fff3cd;
    color: #856404;
}

.feature-badge i {
    margin-right: 0.25rem;
}

.site-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-item {
    text-align: center;
}

.stat-item small {
    display: block;
    color: #666;
    margin-bottom: 0.25rem;
}

.stat-item strong {
    display: block;
    font-size: 1.1rem;
    color: #333;
}

.site-actions {
    display: flex;
    gap: 0.5rem;
}

.site-actions .btn {
    border-radius: 6px;
}

/* Activities */
.activities-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f3f4;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 35px;
    height: 35px;
    background: #f8f9fa;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    color: #667eea;
}

.activity-content {
    flex: 1;
}

.activity-title {
    margin: 0 0 0.25rem 0;
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.activity-meta {
    color: #666;
    font-size: 0.8rem;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s ease;
}

.quick-action:hover {
    background: #667eea;
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
}

.quick-action i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.quick-action span {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #666;
}

.empty-state i {
    color: #ccc;
    margin-bottom: 1rem;
}

.empty-state h5 {
    margin-bottom: 0.5rem;
    color: #999;
}

/* Responsive */
@media (max-width: 768px) {
    .portal-title {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .site-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .site-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .stat-item {
        text-align: left;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
}

/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

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

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Custom Scrollbar */
.sites-list::-webkit-scrollbar,
.activities-list::-webkit-scrollbar {
    width: 6px;
}

.sites-list::-webkit-scrollbar-track,
.activities-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.sites-list::-webkit-scrollbar-thumb,
.activities-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.sites-list::-webkit-scrollbar-thumb:hover,
.activities-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}
