/**
 * Admin styles for YITH Affiliate Custom Shares
 *
 * Premium Tableau de Bord Admin MPCash
 */

:root {
    --color-primary: #0073aa;
    --color-border: #e2e8f0;
    --color-bg-light: #f8fafc;
    --color-text-secondary: #64748b;
    --color-success: #10b981;
    --color-danger: #ef4444;
}

.yacs-admin-dashboard-container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.yacs-admin-header {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 16px;
}

.yacs-admin-header h1 {
    margin: 0 0 6px 0;
    color: #0f172a;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.yacs-admin-header p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 14px;
}

/* Grids & Cards */
.yacs-admin-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.yacs-admin-card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.yacs-admin-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    border-color: #cbd5e1;
}

.yacs-admin-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.yacs-admin-card-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

.yacs-admin-card-header svg {
    flex-shrink: 0;
}

/* Border & text colors */
.border-blue { border-top: 4px solid #3b82f6; }
.text-blue { color: #2563eb; }
.border-purple { border-top: 4px solid #8b5cf6; }
.text-purple { color: #7c3aed; }
.border-teal { border-top: 4px solid #14b8a6; }
.text-teal { color: #0d9488; }
.border-orange { border-top: 4px solid #f97316; }
.text-orange { color: #ea580c; }
.border-green { border-top: 4px solid #10b981; }
.text-green { color: #059669; }
.border-gold { border-top: 4px solid #eab308; }
.text-gold { color: #ca8a04; }

/* Metrics */
.yacs-admin-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.metric-label {
    font-size: 11px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 26px;
    font-weight: 700;
    color: #0f172a;
}

.yacs-admin-submetrics {
    display: flex;
    justify-content: space-between;
    background: var(--color-bg-light);
    border-radius: 6px;
    padding: 10px;
}

.submetric {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: center;
    flex: 1;
}

.submetric .label {
    font-size: 11px;
    color: var(--color-text-secondary);
}

.submetric .value {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

.yacs-admin-submetrics-triple {
    display: flex;
    justify-content: space-between;
    background: var(--color-bg-light);
    border-radius: 6px;
    padding: 10px;
    gap: 8px;
}

.yacs-admin-submetrics-triple .submetric {
    border-right: 1px solid #e2e8f0;
}

.yacs-admin-submetrics-triple .submetric:last-child {
    border-right: none;
}

.yacs-admin-submetrics.two-rows {
    flex-direction: column;
    background: none;
    padding: 0;
}

.yacs-admin-metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background-color: var(--color-bg-light);
    border-radius: 6px;
    margin-bottom: 8px;
}

.yacs-admin-metric-row:last-child {
    margin-bottom: 0;
}

.yacs-admin-metric-row .label {
    font-size: 13px;
    color: #475569;
}

.yacs-admin-metric-row .value {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
}

.yacs-admin-card-body-products {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.product-row .label {
    color: #475569;
    flex-shrink: 0;
}

.product-row .value {
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
    max-width: 150px;
}

.yacs-admin-card-body-commissions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comm-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 4px 0;
}

.comm-item .label {
    color: #475569;
}

.comm-item .value {
    font-weight: 600;
}

.highlight-gold {
    background: #fefbeb;
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 4px;
    border: 1px solid #fef08a;
}

/* Leaderboards */
.yacs-admin-leaderboards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.yacs-leaderboard-card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.yacs-leaderboard-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.yacs-leaderboard-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

.yacs-leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.yacs-leaderboard-table th {
    padding: 10px 8px;
    border-bottom: 2px solid var(--color-border);
    font-weight: 600;
    text-align: left;
    color: var(--color-text-secondary);
}

.yacs-leaderboard-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.yacs-leaderboard-table tr:last-child td {
    border-bottom: none;
}

.product-name-cell {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-data {
    text-align: center;
    color: var(--color-text-secondary);
    padding: 20px 0;
}

/* Affiliate Table list */
.yacs-affiliates-list-section {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.yacs-section-title {
    margin-top: 0;
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 20px;
}

.yacs-admin-filters {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.yacs-admin-filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.yacs-admin-filter-group label {
    font-weight: 600;
    color: #334155;
}

.yacs-admin-filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    background-color: white;
}

.yacs-admin-table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    margin-top: 20px;
}

.yacs-admin-table thead {
    background-color: var(--color-bg-light);
}

.yacs-admin-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--color-border);
    color: #334155;
}

.yacs-admin-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.yacs-admin-table tbody tr:hover {
    background-color: var(--color-bg-light);
}

.yacs-admin-table .yacs-affiliate-name {
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
}

.yacs-admin-table .yacs-affiliate-name:hover {
    text-decoration: underline;
}

.yacs-admin-table .yacs-stat-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.yacs-admin-table .yacs-stat-badge.shares {
    background-color: #e3f2fd;
    color: #1565c0;
}

.yacs-admin-table .yacs-stat-badge.clicks {
    background-color: #f3e5f5;
    color: #6a1b9a;
}

/* Modal styles */
.yacs-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.yacs-modal.active {
    display: block;
}

.yacs-modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 24px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    width: 90%;
    max-width: 550px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.yacs-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
}

.yacs-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.yacs-modal-close {
    font-size: 24px;
    font-weight: bold;
    color: #94a3b8;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    transition: color 0.2s;
}

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

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

.yacs-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
}

.yacs-stats-grid-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 15px 0 24px 0;
}

.yacs-stat-card-detail {
    background-color: var(--color-bg-light);
    border-radius: 8px;
    padding: 14px;
    border: 1px solid var(--color-border);
}

.yacs-stat-card-label {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.yacs-stat-card-value {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

/* Buttons */
.yacs-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

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

.yacs-btn-primary:hover {
    background-color: #005a87;
}

.yacs-btn-secondary {
    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid var(--color-border);
}

.yacs-btn-secondary:hover {
    background-color: #e2e8f0;
}

.yacs-loading {
    display: block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0,0,0,0.1);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 30px auto;
}

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

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

@media (max-width: 768px) {
    .yacs-admin-grid,
    .yacs-admin-leaderboards {
        grid-template-columns: 1fr;
    }

    .yacs-admin-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .yacs-admin-filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .yacs-admin-table {
        font-size: 12px;
    }

    .yacs-admin-table th,
    .yacs-admin-table td {
        padding: 8px 10px;
    }

    .yacs-modal-content {
        width: 95%;
        margin: 20% auto;
    }
}
