/**
 * Polanger Affiliate System - Frontend Styles
 * WooCommerce My Account Integration
 *
 * @package Polanger_Affiliate_System
 * @version 1.2.0
 */

/* ============================================
   REGISTRATION FORM - MODERN DESIGN
   ============================================ */
.pas-register-wrap {
    max-width: 100%;
}

/* Hero Section */
.pas-register-hero {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    color: #fff;
    margin-bottom: 30px;
}

.pas-register-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.pas-register-hero h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
}

.pas-register-subtitle {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
    color: #fff !important;
}

/* Benefits Section */
.pas-register-benefits {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.pas-benefit {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.pas-benefit-icon {
    font-size: 28px;
    line-height: 1;
}

.pas-benefit div {
    display: flex;
    flex-direction: column;
}

.pas-benefit strong {
    font-size: 15px;
    color: #333;
    margin-bottom: 4px;
}

.pas-benefit span {
    font-size: 13px;
    color: #666;
}

/* Form Wrapper */
.pas-register-form-wrap {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.pas-register-form-wrap h3 {
    margin: 0 0 25px 0;
    font-size: 20px;
    color: #333;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

/* Form Sections */
.pas-form-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #f0f0f0;
}

.pas-form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 20px;
    padding-bottom: 0;
}

.pas-form-section h4 {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: #444;
    font-weight: 600;
}

/* Form Groups */
.pas-form-group {
    margin-bottom: 20px;
}

.pas-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.pas-form-group label .required {
    color: #dc3545;
}

.pas-form-group label .pas-optional {
    color: #888;
    font-weight: 400;
    font-size: 13px;
}

.pas-form-group input,
.pas-form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.pas-form-group input:focus,
.pas-form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.pas-form-group input[readonly] {
    background: #f5f5f5;
    color: #666;
}

.pas-field-note {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* Form Row (side by side) */
.pas-form-row {
    display: flex;
    gap: 20px;
}

.pas-form-half {
    flex: 1;
}

/* Terms Section */
.pas-terms-section {
    background: #f8f9fa;
    padding: 20px !important;
    border-radius: 10px;
    margin-top: 10px;
}

.pas-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}

.pas-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    flex-shrink: 0;
}

/* Submit Section */
.pas-form-submit {
    text-align: center;
    margin-top: 30px;
}

.pas-submit-btn {
    display: inline-block;
    padding: 16px 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pas-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.pas-submit-note {
    margin-top: 15px;
    font-size: 13px;
    color: #888;
}

/* Payment Fields Animation */
.pas-payment-fields {
    animation: fadeIn 0.3s ease;
}

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

/* ============================================
   DASHBOARD (My Account)
   ============================================ */
.pas-dashboard h3 {
    margin-top: 0;
    margin-bottom: 20px;
}

.pas-dashboard h4 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: #333;
}

/* Statistics Grid */
.pas-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.pas-stat {
    flex: 1;
    min-width: 120px;
    background: #f8f8f8;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 20px 15px;
    text-align: center;
}

.pas-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #cc0000;
    line-height: 1.2;
}

.pas-stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Affiliate Link */
.pas-link-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.pas-dashboard, .pas-dashboard *, .pas-dashboard *::before, .pas-dashboard *::after,
.pas-register-form-wrap, .pas-register-form-wrap * {
    box-sizing: border-box;
}

.pas-link-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
    background: #f9f9f9;
}

.pas-link-input:focus {
    outline: none;
    border-color: #cc0000;
}

.pas-copy-btn {
    padding: 12px 20px;
    white-space: nowrap;
}

.pas-link-note {
    font-size: 13px;
    color: #888;
    margin-top: 5px;
}

/* Status Badges */
.pas-status-paid {
    color: #28a745;
    font-weight: 600;
}

.pas-status-pending {
    color: #856404;
    font-weight: 600;
}

.pas-status-withdrawal-pending {
    color: #0066cc;
    font-weight: 600;
}

.pas-status-withdrawal-approved {
    color: #17a2b8;
}

/* Source Badges */
.pas-source-link,
.pas-source-coupon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
}

.pas-source-link {
    background: #e3f2fd;
    color: #1565c0;
}

.pas-source-coupon {
    background: #fff3e0;
    color: #e65100;
}

.pas-source-link .dashicons,
.pas-source-coupon .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    font-weight: 600;
}

/* ============================================
   WITHDRAWAL SECTION
   ============================================ */
.pas-withdrawal-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #e5e5e5;
}

.pas-withdrawal-section h4 {
    margin-top: 0;
    margin-bottom: 20px;
}

.pas-withdrawal-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.pas-withdrawal-stat {
    flex: 1;
    background: #f8f8f8;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
}

.pas-withdraw-btn {
    background: #cc0000 !important;
    color: #fff !important;
    border: none !important;
    padding: 12px 25px !important;
    font-weight: 600 !important;
}

.pas-withdraw-btn:hover {
    background: #a80000 !important;
}

.pas-withdrawal-note {
    color: #666;
    font-size: 14px;
    margin-top: 10px;
}

/* Modal Styles */
.pas-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pas-modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.pas-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.pas-modal-close:hover {
    color: #333;
}

.pas-modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
}

.pas-modal-info {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.pas-modal-info p {
    margin: 8px 0;
}

.pas-modal-info.pas-modal-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
}

/* Modal Text Colors */
.pas-modal-text-success {
    color: #28a745;
    font-weight: 600;
}

.pas-modal-text-danger {
    color: #cc0000;
    font-weight: 600;
}

.pas-modal-text-primary {
    color: #0066cc;
    font-weight: 600;
}

.pas-modal-title-warning {
    color: #856404;
    margin-bottom: 5px;
}

.pas-modal-title-success {
    color: #28a745;
}

.pas-modal-title-error {
    color: #dc3545;
}

.pas-modal-subtitle {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

.pas-modal-footer-text {
    margin-top: 20px;
    color: #555;
    font-size: 13px;
    text-align: center;
}

/* Progress Bar */
.pas-progress-wrapper {
    margin-top: 20px;
}

.pas-progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.pas-progress-track {
    background: #e9ecef;
    border-radius: 10px;
    height: 12px;
    overflow: hidden;
}

.pas-progress-bar {
    background: linear-gradient(90deg, #28a745, #20c997);
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

/* Modal Sections - Hidden by default */
.pas-modal-section {
    display: none;
}

/* Payment Fields - Hidden by default, shown via inline style or JS */
.pas-payment-fields.pas-hidden {
    display: none;
}

/* Modal hidden by default */
.pas-modal {
    display: none;
}

/* ============================================
   DASHBOARD HEADER
   ============================================ */
.pas-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.pas-dashboard-header h3 {
    margin: 0;
}

.pas-edit-profile-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.pas-edit-profile-link:hover {
    background: #e0e0e0;
    color: #000;
}

.pas-edit-profile-link .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* ============================================
   PROFILE EDIT PAGE
   ============================================ */
.pas-profile-edit {
    max-width: 700px;
}

.pas-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}

.pas-profile-header h3 {
    margin: 0;
}

.pas-back-link {
    color: #666;
    text-decoration: none;
    font-size: 14px;
}

.pas-back-link:hover {
    color: #333;
}

.pas-profile-form .pas-form-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.pas-profile-form .pas-form-section h4 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    /* Registration Form Responsive */
    .pas-register-hero {
        padding: 30px 15px;
    }

    .pas-register-hero h2 {
        font-size: 22px;
    }

    .pas-register-benefits {
        flex-direction: column;
    }

    .pas-benefit {
        min-width: 100%;
        margin-bottom: 10px;
    }

    .pas-register-form-wrap {
        padding: 20px 15px;
    }

    .pas-form-row {
        flex-direction: column;
        gap: 0;
    }

    .pas-form-half {
        width: 100% !important;
        flex: none !important;
    }

    .pas-submit-btn {
        width: 100%;
        padding: 14px 30px;
    }

    /* Dashboard Responsive */
    .pas-stats {
        gap: 10px;
        flex-wrap: wrap;
    }

    .pas-stat {
        min-width: calc(50% - 10px);
        padding: 15px 10px;
        flex: 1 1 calc(50% - 10px);
    }

    .pas-stat-value {
        font-size: 22px;
    }

    .pas-link-wrapper {
        flex-direction: column;
    }

    .pas-copy-btn {
        width: 100%;
    }

    .pas-withdrawal-stats {
        flex-direction: column;
    }

    .pas-withdrawal-stat {
        width: 100%;
    }

    .pas-modal-content {
        padding: 20px;
        margin: 20px;
        max-width: calc(100% - 40px);
    }

    /* Frontend Tables - Mobile Responsive */
    .pas-dashboard table,
    .pas-dashboard table thead,
    .pas-dashboard table tbody,
    .pas-dashboard table th,
    .pas-dashboard table td,
    .pas-dashboard table tr {
        display: block;
    }

    .pas-dashboard table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .pas-dashboard table tr {
        border: 1px solid #ddd;
        margin-bottom: 12px;
        background: #fff;
        border-radius: 8px;
        overflow: hidden;
    }

    .pas-dashboard table td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding: 10px 12px 10px 45%;
        text-align: left !important;
    }

    .pas-dashboard table td:last-child {
        border-bottom: none;
    }

    .pas-dashboard table td:before {
        content: attr(data-title);
        position: absolute;
        left: 12px;
        width: 40%;
        font-weight: 600;
        color: #333;
    }
}

@media (max-width: 480px) {
    .pas-register-hero h2 {
        font-size: 20px;
    }

    .pas-register-hero p {
        font-size: 14px;
    }

    .pas-stat {
        min-width: 100%;
        flex: 1 1 100%;
    }

    .pas-stat-value {
        font-size: 20px;
    }

    .pas-link-box {
        font-size: 12px;
        padding: 10px;
    }

    .pas-modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
        padding: 15px;
    }

    .pas-progress-header {
        font-size: 11px;
    }

    .pas-dashboard table td {
        padding: 8px 10px 8px 50%;
    }

    .pas-dashboard table td:before {
        width: 45%;
    }
}

/* Keep WooCommerce's responsive table rules from overlapping labels and long statuses. */
@media (max-width: 768px) {
    .woocommerce .pas-dashboard table.shop_table_responsive tr td[data-title] {
        display: grid;
        grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
        gap: 8px;
        align-items: start;
        padding: 10px 12px;
        text-align: left !important;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .woocommerce .pas-dashboard table.shop_table_responsive tr td[data-title]::before {
        position: static;
        float: none;
        width: auto;
        grid-column: 1;
    }

    .woocommerce .pas-dashboard table.shop_table_responsive tr td[data-title] > * {
        grid-column: 2;
        min-width: 0;
        white-space: normal;
    }
}
