/**
 * Developer Wallet Frontend Styles
 */

:root {
    --dw-primary: #6366f1;
    --dw-secondary: #8b5cf6;
    --dw-success: #22c55e;
    --dw-danger: #ef4444;
    --dw-warning: #f59e0b;
    --dw-radius: 16px;
}

.dw-wallet {
    direction: rtl;
    font-family: inherit;
    max-width: 600px;
    margin: 0 auto;
}

/* ============ Wallet Card ============ */
.dw-wallet-card {
    border-radius: var(--dw-radius);
    padding: 25px;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    min-height: 180px;
}

.dw-card-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.1;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.2) 0%, transparent 40%);
}

.dw-card-content {
    position: relative;
    z-index: 1;
}

.dw-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.dw-card-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.dw-card-logo-placeholder {
    width: 40px;
    height: 40px;
}

.dw-card-logo-placeholder svg {
    width: 100%;
    height: 100%;
}

.dw-card-title {
    font-size: 14px;
    opacity: 0.9;
}

.dw-card-balance {
    margin-bottom: 20px;
}

.dw-card-balance-label {
    font-size: 12px;
    opacity: 0.8;
    display: block;
    margin-bottom: 5px;
}

.dw-card-balance-amount {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.dw-card-amount {
    font-size: 32px;
    font-weight: 700;
}

.dw-card-currency {
    font-size: 14px;
    opacity: 0.9;
}

.dw-card-code {
    margin-bottom: 15px;
}

.dw-card-code-number {
    font-size: 20px;
    letter-spacing: 4px;
    font-family: monospace;
}

.dw-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dw-card-holder {
    font-size: 14px;
}

.dw-card-chip {
    width: 40px;
    height: 32px;
}

/* ============ Wallet Code Box ============ */
.dw-wallet-code-box {
    background: #f8f9fa;
    border-radius: var(--dw-radius);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.dw-code-label {
    color: #666;
    font-size: 14px;
}

.dw-code-value {
    font-family: monospace;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 2px;
    flex: 1;
}

.dw-copy-btn {
    background: var(--dw-primary);
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.dw-copy-btn:hover {
    background: var(--dw-secondary);
}

.dw-copy-btn svg {
    width: 14px;
    height: 14px;
}

/* ============ Action Buttons ============ */
.dw-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 25px;
}

.dw-action-btn {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--dw-radius);
    padding: 15px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.dw-action-btn:hover {
    border-color: var(--dw-primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.dw-action-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
}

.dw-action-icon svg {
    width: 20px;
    height: 20px;
}

.dw-action-deposit .dw-action-icon {
    background: rgba(34, 197, 94, 0.1);
    color: var(--dw-success);
}

.dw-action-withdraw .dw-action-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--dw-danger);
}

.dw-action-loan .dw-action-icon {
    background: rgba(99, 102, 241, 0.1);
    color: var(--dw-primary);
}

.dw-action-text {
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

/* ============ Sections ============ */
.dw-section {
    background: #fff;
    border-radius: var(--dw-radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
}

.dw-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 15px;
    font-size: 16px;
    font-weight: 600;
}

.dw-section-title svg {
    width: 20px;
    height: 20px;
    color: var(--dw-primary);
}

/* ============ Pending Items ============ */
.dw-pending-section {
    background: #fffbeb;
    border-color: #fcd34d;
}

.dw-pending-item {
    background: #fff;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.dw-pending-item:last-child {
    margin-bottom: 0;
}

.dw-pending-amount {
    font-weight: 600;
    font-size: 16px;
}

.dw-pending-status {
    background: #fef3c7;
    color: #92400e;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    margin-right: 10px;
}

.dw-pending-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fef3c7;
    padding: 8px 15px;
    border-radius: 8px;
}

.dw-timer-text {
    font-size: 12px;
    color: #92400e;
}

.dw-timer-value {
    font-family: monospace;
    font-size: 16px;
    font-weight: 600;
    color: #92400e;
}

.dw-timer-expired .dw-timer-value {
    color: var(--dw-danger);
}

/* ============ Funds ============ */
.dw-funds-grid {
    display: grid;
    gap: 20px;
}

@media (min-width: 768px) {
    .dw-funds-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.dw-fund-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.dw-fund-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.dw-fund-joined {
    border-color: var(--dw-success);
}

.dw-fund-banner {
    height: 120px;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: linear-gradient(135deg, var(--dw-primary), var(--dw-secondary));
}

.dw-fund-banner .dw-fund-badge {
    position: absolute;
    top: 10px;
    left: 10px;
}

.dw-fund-body {
    padding: 20px;
}

.dw-fund-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.dw-fund-header h5 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #1f2937;
}

.dw-fund-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.dw-badge-success {
    background: var(--dw-success);
    color: #fff;
}

.dw-badge-danger {
    background: var(--dw-danger);
    color: #fff;
}

.dw-fund-desc {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 15px;
    line-height: 1.6;
}

.dw-fund-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 10px;
}

.dw-fund-stat {
    flex: 1;
    text-align: center;
}

.dw-stat-label {
    display: block;
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.dw-stat-value {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

/* قابلیت‌های شرطی (ریواردها) */
.dw-fund-rewards {
    margin: 15px 0;
    padding: 15px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 12px;
}

.dw-rewards-title {
    font-size: 14px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 12px;
}

.dw-rewards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dw-reward-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255,255,255,0.7);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.dw-reward-item.dw-reward-unlocked {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid var(--dw-success);
}

.dw-reward-check {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.dw-reward-check svg {
    width: 100%;
    height: 100%;
    stroke: #d1d5db;
}

.dw-reward-unlocked .dw-reward-check svg {
    stroke: var(--dw-success);
}

.dw-reward-content {
    flex: 1;
}

.dw-reward-value {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.dw-reward-desc {
    display: block;
    font-size: 11px;
    color: #6b7280;
}

.dw-reward-progress {
    font-size: 11px;
    color: #92400e;
    background: #fff;
    padding: 4px 8px;
    border-radius: 20px;
}

.dw-fund-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}

.dw-fund-actions {
    text-align: left;
    margin-top: 15px;
}

.dw-btn-disabled {
    background: #d1d5db !important;
    cursor: not-allowed !important;
}

/* ============ Loans ============ */
.dw-loan-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.dw-loan-card:last-child {
    margin-bottom: 0;
}

.dw-loan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.dw-loan-header h5 {
    margin: 0;
    font-size: 15px;
}

.dw-loan-status {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
}

.dw-loan-status.dw-status-active {
    background: #d1fae5;
    color: #065f46;
}

.dw-loan-progress {
    margin-bottom: 15px;
}

.dw-progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.dw-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--dw-primary), var(--dw-secondary));
    border-radius: 10px;
    transition: width 0.3s;
}

.dw-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
}

.dw-loan-next {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.dw-next-info {
    font-size: 13px;
}

.dw-next-info span {
    display: block;
}

.dw-next-info span:first-child {
    font-weight: 600;
}

/* ============ Transactions ============ */
.dw-transactions-list {
    max-height: 400px;
    overflow-y: auto;
}

.dw-transaction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.dw-tx-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dw-tx-icon svg {
    width: 18px;
    height: 18px;
}

.dw-tx-positive .dw-tx-icon {
    background: rgba(34, 197, 94, 0.1);
    color: var(--dw-success);
}

.dw-tx-negative .dw-tx-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--dw-danger);
}

.dw-tx-details {
    flex: 1;
}

.dw-tx-type {
    display: block;
    font-weight: 500;
    font-size: 14px;
}

.dw-tx-date {
    font-size: 12px;
    color: #999;
}

.dw-tx-amount {
    font-weight: 600;
    font-size: 15px;
}

.dw-tx-amount small {
    font-size: 11px;
    font-weight: normal;
    color: #666;
    margin-right: 3px;
}

.dw-tx-positive .dw-tx-amount {
    color: var(--dw-success);
}

.dw-tx-negative .dw-tx-amount {
    color: var(--dw-danger);
}

/* ============ Buttons ============ */
.dw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.dw-btn-primary {
    background: var(--dw-primary);
    color: #fff;
}

.dw-btn-primary:hover {
    background: var(--dw-secondary);
}

.dw-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.dw-btn-secondary:hover {
    background: #e5e7eb;
}

.dw-btn-block {
    width: 100%;
}

.dw-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ============ Modal ============ */
.dw-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: none;
}

.dw-modal.dw-modal-open {
    display: flex;
}

.dw-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.dw-modal-box {
    position: relative;
    background: #fff;
    border-radius: var(--dw-radius);
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto;
    z-index: 1;
}

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

.dw-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.dw-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}

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

.dw-modal-body {
    padding: 20px;
}

body.dw-modal-active {
    overflow: hidden;
}

/* ============ Forms ============ */
.dw-form-group {
    margin-bottom: 15px;
}

.dw-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
}

.dw-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.dw-input:focus {
    border-color: var(--dw-primary);
    outline: none;
}

.dw-quick-amounts {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.dw-quick-amounts button {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.dw-quick-amounts button:hover {
    background: var(--dw-primary);
    color: #fff;
    border-color: var(--dw-primary);
}

/* Withdraw Summary */
.dw-withdraw-summary {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.dw-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.dw-summary-row:not(:last-child) {
    border-bottom: 1px dashed #ddd;
}

.dw-summary-total {
    font-weight: 600;
    font-size: 16px;
    color: var(--dw-primary);
}

/* ============ Toast ============ */
.dw-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 25px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    z-index: 999999;
    opacity: 0;
    transition: all 0.3s;
}

.dw-toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.dw-toast-success {
    background: var(--dw-success);
}

.dw-toast-error {
    background: var(--dw-danger);
}

/* ============ Login Required ============ */
.dw-login-required {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: var(--dw-radius);
}

.dw-login-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dw-login-icon svg {
    width: 30px;
    height: 30px;
    color: var(--dw-primary);
}

.dw-login-required p {
    color: #666;
    margin-bottom: 20px;
}

/* ============ Empty State ============ */
.dw-empty {
    text-align: center;
    padding: 20px;
    color: #999;
}

/* ============ Inline Balance ============ */
.dw-balance-inline {
    font-weight: 600;
    color: var(--dw-primary);
}

/* ============ Responsive ============ */
@media (max-width: 480px) {
    .dw-wallet-card {
        padding: 20px;
    }
    
    .dw-card-amount {
        font-size: 26px;
    }
    
    .dw-card-code-number {
        font-size: 16px;
    }
    
    .dw-actions-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .dw-wallet-code-box {
        flex-wrap: wrap;
    }
    
    .dw-code-value {
        width: 100%;
        order: 2;
        margin-top: 5px;
    }
    
    .dw-copy-btn {
        order: 3;
    }
}

/* ============ Floating Menu ============ */
.dw-floating-menu {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 8px;
    background: var(--dw-fm-bg, #6366f1);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.1) inset;
    backdrop-filter: blur(10px);
}

.dw-floating-right {
    right: 15px;
    border-radius: 20px 0 0 20px;
}

.dw-floating-left {
    left: 15px;
    border-radius: 0 20px 20px 0;
}

.dw-fm-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 12px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--dw-fm-color, #fff);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.dw-fm-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0);
    transition: all 0.3s ease;
    border-radius: inherit;
}

.dw-fm-item:hover::before {
    background: rgba(255,255,255,0.15);
}

.dw-fm-item:hover {
    transform: scale(1.1);
}

.dw-fm-item.active::before {
    background: rgba(255,255,255,0.25);
}

.dw-fm-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.dw-fm-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.dw-fm-text {
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    position: relative;
    z-index: 1;
    opacity: 0.9;
}

/* Desktop - متن همیشه نمایش داده میشود */
@media (min-width: 769px) {
    .dw-floating-menu {
        padding: 14px 10px;
    }
    
    .dw-fm-item {
        padding: 12px 10px;
        min-width: 60px;
    }
    
    .dw-fm-text {
        font-size: 11px;
        margin-top: 4px;
        opacity: 1;
        visibility: visible;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .dw-floating-menu {
        bottom: 15px;
        top: auto;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        flex-direction: row;
        border-radius: 25px;
        padding: 8px 16px;
        gap: 5px;
    }
    
    .dw-floating-right,
    .dw-floating-left {
        left: 50%;
        right: auto;
        border-radius: 25px;
    }
    
    .dw-fm-item {
        padding: 10px 14px;
    }
    
    .dw-fm-icon {
        width: 24px;
        height: 24px;
    }
    
    .dw-fm-text {
        font-size: 9px;
    }
}

/* Animation */
@keyframes floatMenuPulse {
    0%, 100% {
        box-shadow: 0 10px 40px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.1) inset;
    }
    50% {
        box-shadow: 0 10px 40px rgba(0,0,0,0.3), 0 0 0 2px rgba(255,255,255,0.2) inset;
    }
}

.dw-floating-menu {
    animation: floatMenuPulse 3s ease infinite;
}

/* ============ سازگاری با WooCommerce My Account ============ */
.woocommerce-account .dw-wallet {
    max-width: 100%;
}

.woocommerce-account .dw-wallet-card {
    margin-bottom: 25px;
}

.woocommerce-account .dw-section {
    margin-bottom: 25px;
}

.woocommerce-account .dw-btn {
    font-family: inherit;
}

/* رفع تداخل با استایل‌های ووکامرس */
.woocommerce-account .dw-wallet input[type="text"],
.woocommerce-account .dw-wallet input[type="number"],
.woocommerce-account .dw-wallet select,
.woocommerce-account .dw-wallet textarea {
    height: auto;
    padding: 12px 15px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

.woocommerce-account .dw-wallet input:focus,
.woocommerce-account .dw-wallet select:focus {
    border-color: var(--dw-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.woocommerce-account .dw-modal-box {
    max-height: 90vh;
}

/* رفع مشکل z-index در ووکامرس */
.woocommerce-account .dw-modal {
    z-index: 999999;
}

.woocommerce-account .dw-floating-menu {
    z-index: 999998;
}
