/**
 * WHP Partner Portal - Frontend Styles
 *
 * Styles for the partner dashboard within WooCommerce My Account.
 */

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

.whp-kpi-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: box-shadow 0.2s;
}

.whp-kpi-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.whp-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #f0f4ff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.whp-kpi-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: #3b82f6;
}

.whp-kpi-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.whp-kpi-label {
    display: block;
    font-size: 0.85rem;
    color: #64748b;
}

/* Page Header */
.whp-page-header {
    margin-bottom: 1.5rem;
}

.whp-page-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

/* Quick Links */
.whp-quick-links {
    margin-bottom: 2rem;
}

.whp-quick-links h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: #334155;
}

.whp-quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.whp-quick-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none;
    color: #334155;
    font-weight: 500;
    transition: all 0.2s;
}

.whp-quick-link:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.whp-quick-link .dashicons {
    color: #3b82f6;
}

/* Table Responsive */
.whp-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Tables */
.whp-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.whp-table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.whp-table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.9rem;
}

.whp-table tbody tr:hover {
    background: #f8fafc;
}

.whp-clickable-row {
    cursor: pointer;
}

.whp-table tfoot td {
    padding: 0.75rem;
    border-top: 2px solid #e2e8f0;
}

/* Status Badges */
.whp-status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.whp-status-active,
.whp-status-definitief {
    background: #dcfce7;
    color: #166534;
}

.whp-status-suspended,
.whp-status-warning {
    background: #fef3c7;
    color: #92400e;
}

.whp-status-concept {
    background: #e0e7ff;
    color: #3730a3;
}

.whp-status-cancelled,
.whp-status-expired,
.whp-status-deleted {
    background: #fce7f3;
    color: #9d174d;
}

.whp-status-pending,
.whp-status-transferring {
    background: #e0f2fe;
    color: #075985;
}

/* Filters */
.whp-filters {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.whp-search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
}

.whp-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.whp-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fff;
}

/* Buttons */
.whp-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.whp-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.whp-btn-primary {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.whp-btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.whp-btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

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

/* Pagination */
.whp-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.whp-pagination-info {
    font-size: 0.85rem;
    color: #64748b;
}

/* Modal */
.whp-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.whp-modal-content {
    background: #fff;
    border-radius: 12px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.whp-modal-wide {
    max-width: 800px;
}

.whp-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.whp-modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
}

.whp-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.whp-modal-close:hover {
    color: #334155;
}

.whp-modal-body {
    padding: 1.5rem;
}

/* Detail List */
.whp-detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
}

.whp-detail-list dt {
    font-weight: 600;
    color: #475569;
}

.whp-detail-list dd {
    margin: 0;
    color: #334155;
}

/* Tags */
.whp-tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: #f1f5f9;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #475569;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

/* Forms */
.whp-form-section {
    margin-bottom: 2rem;
}

.whp-form-section h3 {
    margin-bottom: 1rem;
    color: #1e293b;
}

.whp-form-row {
    margin-bottom: 1rem;
}

.whp-form-row label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 500;
    color: #374151;
}

.whp-input {
    width: 100%;
    max-width: 400px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
}

.whp-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.whp-form-hint {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Notices */
.whp-notice {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.whp-notice-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.whp-notice-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Domain Check */
.whp-domain-check {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 2rem;
}

.whp-domain-check h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.whp-domain-check-form {
    display: flex;
    gap: 0.5rem;
}

.whp-domain-check-result {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-weight: 500;
}

.whp-success {
    background: #dcfce7;
    color: #166534;
}

.whp-warning {
    background: #fef3c7;
    color: #92400e;
}

/* Cards */
.whp-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.whp-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.whp-card-header h3 {
    margin: 0;
}

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

/* Search Small */
.whp-search-small {
    min-width: 150px;
    max-width: 250px;
    flex: none;
}

/* Input Group (domain check) */
.whp-input-group {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
}

.whp-input-group .whp-search-input {
    border-radius: 6px 0 0 6px;
    border-right: none;
    min-width: 120px;
}

.whp-input-separator {
    padding: 0.5rem 0.35rem;
    background: #f1f5f9;
    border: 1px solid #d1d5db;
    border-left: none;
    border-right: none;
    color: #64748b;
    font-weight: 600;
}

.whp-input-group .whp-select {
    border-radius: 0 6px 6px 0;
}

/* Error State */
.whp-error {
    background: #fef2f2;
    color: #991b1b;
}

.whp-domain-check-result .dashicons {
    vertical-align: middle;
    margin-right: 0.25rem;
}

/* Text Utilities */
.whp-text-success {
    color: #166534;
    font-weight: 500;
}

.whp-text-warning {
    color: #92400e;
    font-weight: 500;
}

.whp-text-muted {
    color: #94a3b8;
}

/* Loading & Empty */
.whp-loading,
.whp-empty {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
}

.whp-loading .dashicons {
    vertical-align: middle;
    margin-right: 0.35rem;
}

/* Spin Animation */
@keyframes whp-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.whp-spin {
    animation: whp-spin 1s linear infinite;
    display: inline-block;
}

/* Utility */
[x-cloak] {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .whp-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .whp-filters {
        flex-direction: column;
    }

    .whp-table {
        font-size: 0.85rem;
    }

    .whp-table thead th,
    .whp-table tbody td {
        padding: 0.5rem;
    }

    .whp-modal-content,
    .whp-modal-wide {
        max-width: 100%;
    }

    .whp-domain-check-form {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .whp-kpi-grid {
        grid-template-columns: 1fr;
    }
}

/* Resource Grid */
.whp-resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.whp-resource-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem;
}

.whp-resource-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.whp-resource-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.35rem;
}

.whp-resource-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.whp-resource-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.whp-bar-ok { background: #22c55e; }
.whp-bar-warning { background: #f59e0b; }
.whp-bar-danger { background: #ef4444; }

/* Tabs */
.whp-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.whp-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 1.25rem;
    border: none;
    background: none;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.whp-tab:hover {
    color: #334155;
}

.whp-tab-active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.whp-tab .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Toggle Switch */
.whp-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.whp-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.whp-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #cbd5e1;
    border-radius: 24px;
    transition: 0.2s;
}

.whp-toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}

.whp-toggle input:checked + .whp-toggle-slider {
    background: #3b82f6;
}

.whp-toggle input:checked + .whp-toggle-slider::before {
    transform: translateX(20px);
}

.whp-toggle input:disabled + .whp-toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Domain Actions Grid */
.whp-domain-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.whp-action-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
}

.whp-action-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
}

.whp-action-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.whp-action-status {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Checkbox Label */
.whp-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: #374151;
    cursor: pointer;
}

.whp-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

/* Responsive tabs */
@media (max-width: 768px) {
    .whp-domain-actions-grid {
        grid-template-columns: 1fr;
    }

    .whp-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .whp-tab {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* DNS Records */
.whp-table-compact th,
.whp-table-compact td {
    padding: 0.4rem 0.6rem;
    font-size: 0.82rem;
}

.whp-dns-type {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: monospace;
    background: #e2e8f0;
    color: #334155;
}

.whp-dns-type[x-text="'A'"],
tr:has(td .whp-dns-type) td:first-child .whp-dns-type {
    /* Color handled via type matching below */
}

/* DNSSEC Status */
.whp-dnssec-status {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.whp-dnssec-active {
    background: #dcfce7;
    color: #166534;
}

.whp-dnssec-inactive {
    background: #fef3c7;
    color: #92400e;
}

/* Sortable Columns */
.whp-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.whp-sortable:hover {
    color: #1e293b;
    background: #f1f5f9;
}

.whp-sort-icon {
    display: inline-block;
    margin-left: 0.25rem;
    font-size: 0.7rem;
    color: #3b82f6;
}

/* Column Alignment */
.whp-col-center {
    text-align: center;
}

.whp-col-right {
    text-align: right;
}

/* Email/Status Indicators */
.whp-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 22px;
    padding: 0 0.35rem;
    border-radius: 11px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.whp-indicator-active {
    background: #dbeafe;
    color: #1d4ed8;
}

.whp-indicator-inactive {
    color: #cbd5e1;
    font-size: 0.85rem;
}

/* PHP Version Badge */
.whp-php-badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: monospace;
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* Detail Grid (Two-Column) */
.whp-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
    .whp-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Sections in Modal */
.whp-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}

.whp-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.whp-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.whp-section-header .whp-section-title {
    margin-bottom: 0;
}

/* Count Badge */
.whp-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 0.35rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    background: #e0e7ff;
    color: #4338ca;
}

/* Danger Button */
.whp-btn-danger {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

.whp-btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

/* Text Colors */
.whp-text-danger {
    color: #dc2626;
    font-weight: 500;
}

.whp-text-success {
    color: #16a34a;
    font-weight: 500;
}

/* Progress Bar Inline */
.whp-progress-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.whp-progress-bar {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.whp-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.whp-progress-label {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
}

/* Stats Summary Row */
.whp-stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 6px;
}

.whp-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 80px;
}

.whp-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
}

.whp-stat-label {
    font-size: 0.75rem;
    color: #64748b;
    text-align: center;
}

/* Partner Own Websites */
.whp-own-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* DS Record Code Block */
.whp-code-block {
    display: block;
    padding: 0.5rem 0.75rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
    word-break: break-all;
    color: #334155;
}

/* Plan Distribution */
.whp-plan-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.whp-plan-row:last-child {
    border-bottom: none;
}

.whp-plan-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    color: #334155;
}

.whp-plan-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: #3b82f6;
}

.whp-plan-cost {
    font-size: 0.85rem;
    color: #64748b;
    min-width: 80px;
    text-align: right;
}
