/* WooCommerce Affiliate - Frontend Styles */

/* ===== VARIABLES ===== */
:root {
    --woo-aff-primary: #2271b1;
    --woo-aff-primary-hover: #135e96;
    --woo-aff-success: #28a745;
    --woo-aff-warning: #ffc107;
    --woo-aff-danger: #dc3545;
    --woo-aff-info: #17a2b8;
    --woo-aff-dark: #1d2327;
    --woo-aff-gray: #666;
    --woo-aff-light-gray: #f8f9fa;
    --woo-aff-border: #ddd;
    --woo-aff-radius: 8px;
    --woo-aff-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

/* ===== BUTTONS ===== */
.woo-aff-btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.woo-aff-btn-primary {
    background: var(--woo-aff-primary);
    color: #fff !important;
}

.woo-aff-btn-primary:hover {
    background: var(--woo-aff-primary-hover);
    color: #fff !important;
}

.woo-aff-btn-full {
    width: 100%;
}

.woo-aff-btn-large {
    padding: 14px 30px;
    font-size: 16px;
}

.woo-aff-link-btn {
    background: none;
    border: none;
    color: var(--woo-aff-primary);
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    font-size: inherit;
}

.woo-aff-link-btn:hover {
    color: var(--woo-aff-primary-hover);
}

/* ===== ACCOUNT BUTTON ===== */
.woo-aff-login-trigger,
.woo-aff-account-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--woo-aff-primary);
    color: #fff !important;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.woo-aff-login-trigger:hover,
.woo-aff-account-btn:hover {
    background: var(--woo-aff-primary-hover);
    color: #fff !important;
}

/* ===== MODAL POPUP ===== */
.woo-aff-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.woo-aff-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.woo-aff-modal-container {
    background: #fff;
    border-radius: var(--woo-aff-radius);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--woo-aff-shadow);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.woo-aff-modal-overlay.active .woo-aff-modal-container {
    transform: translateY(0);
}

.woo-aff-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    border: none;
    background: var(--woo-aff-light-gray);
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: var(--woo-aff-gray);
    transition: all 0.2s ease;
    z-index: 10;
}

.woo-aff-modal-close:hover {
    background: var(--woo-aff-danger);
    color: #fff;
}

/* ===== AUTH FORMS IN MODAL ===== */
.woo-aff-auth-form {
    padding: 40px 30px 30px;
    display: none;
}

.woo-aff-auth-form.active {
    display: block;
}

.woo-aff-auth-form h3 {
    margin: 0 0 25px 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--woo-aff-dark);
    text-align: center;
}

.woo-aff-form-desc {
    text-align: center;
    color: var(--woo-aff-gray);
    margin-bottom: 20px;
    font-size: 14px;
}

.woo-aff-form-row {
    margin-bottom: 18px;
}

.woo-aff-form-row label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--woo-aff-dark);
    font-size: 14px;
}

.woo-aff-form-row input[type="text"],
.woo-aff-form-row input[type="email"],
.woo-aff-form-row input[type="password"],
.woo-aff-form-row input[type="tel"],
.woo-aff-form-row input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--woo-aff-border);
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.woo-aff-form-row input:focus {
    outline: none;
    border-color: var(--woo-aff-primary);
}

.woo-aff-form-row small {
    display: block;
    margin-top: 5px;
    color: var(--woo-aff-gray);
    font-size: 12px;
}

.woo-aff-remember {
    margin-bottom: 20px;
}

.woo-aff-remember label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.woo-aff-form-message {
    margin-top: 15px;
    padding: 12px 15px;
    border-radius: 5px;
    font-size: 14px;
    display: none;
}

.woo-aff-form-message.error {
    background: #f8d7da;
    color: #721c24;
    display: block;
}

.woo-aff-form-message.success {
    background: #d4edda;
    color: #155724;
    display: block;
}

.woo-aff-auth-links {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.woo-aff-auth-links a {
    color: var(--woo-aff-primary);
    text-decoration: none;
    font-size: 14px;
}

.woo-aff-auth-links a:hover {
    text-decoration: underline;
}

.woo-aff-separator {
    margin: 0 10px;
    color: #ccc;
}

.woo-aff-ctv-link {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #eee;
    text-align: center;
}

.woo-aff-ctv-link a {
    color: var(--woo-aff-success);
    font-weight: 500;
}

/* Row half for side-by-side fields */
.woo-aff-row-half {
    display: inline-block;
    width: calc(50% - 8px);
    vertical-align: top;
}

.woo-aff-row-half:first-child {
    margin-right: 12px;
}

.woo-aff-form-row-group {
    display: flex;
    gap: 15px;
}

.woo-aff-form-row-group .woo-aff-form-row {
    flex: 1;
}

/* ===== MESSAGES ===== */
.woo-aff-message {
    padding: 15px 20px;
    border-radius: var(--woo-aff-radius);
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.woo-aff-message.info {
    background: #e7f3ff;
    border-left: 4px solid var(--woo-aff-primary);
    color: #0c5460;
}

.woo-aff-message.success {
    background: #d4edda;
    border-left: 4px solid var(--woo-aff-success);
    color: #155724;
}

.woo-aff-message.warning {
    background: #fff3cd;
    border-left: 4px solid var(--woo-aff-warning);
    color: #856404;
}

.woo-aff-message.error {
    background: #f8d7da;
    border-left: 4px solid var(--woo-aff-danger);
    color: #721c24;
}

.woo-aff-message a {
    color: inherit;
    font-weight: 600;
}

/* ===== REGISTER FORM (CTV) ===== */
.woo-aff-register-form {
    max-width: 600px;
    margin: 0 auto;
}

.woo-aff-register-form h2 {
    text-align: center;
    margin-bottom: 10px;
}

.woo-aff-intro {
    text-align: center;
    color: var(--woo-aff-gray);
    margin-bottom: 30px;
}

.woo-aff-form-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #eee;
}

.woo-aff-form-section:last-of-type {
    border-bottom: none;
}

.woo-aff-form-section h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: var(--woo-aff-dark);
}

.woo-aff-form-desc {
    color: var(--woo-aff-gray);
    font-size: 14px;
    margin-bottom: 15px;
}

.woo-aff-logged-in-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--woo-aff-light-gray);
    padding: 20px;
    border-radius: var(--woo-aff-radius);
}

.woo-aff-user-avatar img {
    border-radius: 50%;
}

.woo-aff-user-info strong {
    display: block;
    font-size: 16px;
    color: var(--woo-aff-dark);
}

.woo-aff-user-info span {
    color: var(--woo-aff-gray);
    font-size: 14px;
}

.woo-aff-checkbox-label {
    display: flex !important;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: normal !important;
}

.woo-aff-checkbox-label input[type="checkbox"] {
    margin-top: 3px;
}

.woo-aff-form-submit {
    text-align: center;
    margin-top: 30px;
}

.woo-aff-login-link {
    text-align: center;
    margin-top: 20px;
    color: var(--woo-aff-gray);
}

.woo-aff-login-prompt {
    text-align: center;
    margin-top: 15px;
}

/* ===== DASHBOARD ===== */
.woo-aff-dashboard {
    max-width: 1000px;
    margin: 0 auto;
}

.woo-aff-dashboard-header {
    margin-bottom: 30px;
}

.woo-aff-dashboard-header h2 {
    margin-bottom: 5px;
}

/* Affiliate Info */
.woo-aff-affiliate-info {
    background: var(--woo-aff-light-gray);
    padding: 20px;
    border-radius: var(--woo-aff-radius);
    margin-bottom: 30px;
}

.woo-aff-info-box {
    margin-bottom: 15px;
}

.woo-aff-info-box:last-child {
    margin-bottom: 0;
}

.woo-aff-info-box label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
}

.woo-aff-code-display,
.woo-aff-link-display {
    display: flex;
    gap: 10px;
    align-items: center;
}

.woo-aff-code-display code {
    font-size: 18px;
    padding: 8px 15px;
    background: #fff;
    border: 1px solid var(--woo-aff-border);
    border-radius: 4px;
}

.woo-aff-link-display input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--woo-aff-border);
    border-radius: 4px;
    font-size: 14px;
}

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

.woo-aff-stat-box {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: var(--woo-aff-radius);
    padding: 20px;
    text-align: center;
    transition: box-shadow 0.3s;
}

.woo-aff-stat-box:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.woo-aff-stat-box.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
}

.woo-aff-stat-box .stat-icon {
    font-size: 28px;
    display: block;
    margin-bottom: 10px;
}

.woo-aff-stat-box .stat-number {
    font-size: 28px;
    font-weight: 700;
    display: block;
}

.woo-aff-stat-box .stat-label {
    font-size: 13px;
    color: var(--woo-aff-gray);
    display: block;
    margin-top: 5px;
}

.woo-aff-stat-box.highlight .stat-label {
    color: rgba(255, 255, 255, 0.8);
}

/* Commission Summary */
.woo-aff-commission-summary {
    margin-bottom: 30px;
}

.woo-aff-commission-summary h3 {
    margin-bottom: 15px;
}

.woo-aff-commission-boxes {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.commission-box {
    flex: 1;
    min-width: 150px;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
}

.commission-box.pending {
    background: #fff3cd;
}

.commission-box.approved {
    background: #d4edda;
}

.commission-box.paid {
    background: #cce5ff;
}

.commission-box .amount {
    font-size: 20px;
    font-weight: 700;
    display: block;
}

.commission-box .label {
    font-size: 12px;
    color: var(--woo-aff-gray);
}

/* Tables */
.woo-aff-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.woo-aff-table th,
.woo-aff-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.woo-aff-table th {
    background: var(--woo-aff-light-gray);
    font-weight: 600;
}

.woo-aff-table tbody tr:hover {
    background: var(--woo-aff-light-gray);
}

/* Status badges */
.woo-aff-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.woo-aff-status.status-pending {
    background: #fff3cd;
    color: #856404;
}

.woo-aff-status.status-approved {
    background: #d4edda;
    color: #155724;
}

.woo-aff-status.status-paid {
    background: #cce5ff;
    color: #004085;
}

.woo-aff-status.status-rejected,
.woo-aff-status.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}

/* Withdrawal Form */
.woo-aff-withdrawal-section {
    background: var(--woo-aff-light-gray);
    padding: 20px;
    border-radius: var(--woo-aff-radius);
    margin-bottom: 30px;
}

.woo-aff-withdrawal-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

/* Copy Link Button */
.woo-aff-copy-link {
    cursor: pointer;
    padding: 8px 15px;
    background: var(--woo-aff-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    transition: background 0.2s;
}

.woo-aff-copy-link:hover {
    background: var(--woo-aff-primary-hover);
}

/* Product Affiliate Box */
.woo-aff-product-affiliate-box {
    background: #f0f7ff;
    border: 1px solid #cce5ff;
    border-radius: var(--woo-aff-radius);
    padding: 15px;
    margin: 15px 0;
}

.woo-aff-product-affiliate-box h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #004085;
}

.woo-aff-link-input-wrap {
    display: flex;
    gap: 10px;
}

.woo-aff-link-input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--woo-aff-border);
    border-radius: 4px;
    font-size: 13px;
}

.woo-aff-commission-info {
    margin: 10px 0 0 0;
    font-size: 13px;
    color: var(--woo-aff-success);
    font-weight: 500;
}

/* Loading state */
.woo-aff-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.woo-aff-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: woo-aff-spin 0.8s linear infinite;
}

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

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .woo-aff-modal-container {
        max-width: 100%;
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .woo-aff-auth-form {
        padding: 30px 20px 20px;
    }
    
    .woo-aff-row-half {
        display: block;
        width: 100%;
        margin-right: 0 !important;
    }
    
    .woo-aff-form-row-group {
        flex-direction: column;
        gap: 0;
    }
    
    .woo-aff-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .woo-aff-table {
        font-size: 14px;
    }
    
    .woo-aff-table th,
    .woo-aff-table td {
        padding: 8px 10px;
    }
    
    .woo-aff-commission-boxes {
        flex-direction: column;
    }
    
    .woo-aff-code-display,
    .woo-aff-link-display {
        flex-direction: column;
        align-items: stretch;
    }
    
    .woo-aff-link-display input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .woo-aff-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .woo-aff-separator {
        display: none;
    }
    
    .woo-aff-auth-links a {
        display: block;
        margin: 10px 0;
    }
}
