/* ================================================
   JUP - Professional User Panel Styles
   RTL-First, Modern Design
   ================================================ */

/* === Reset & Base === */
.jup-panel *,
.jup-panel *::before,
.jup-panel *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.jup-panel {
    display: flex;
    direction: rtl;
    font-family: 'IRANSans', 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    min-height: 80vh;
    background: #f1f5f9;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.06);
    position: relative;
    color: var(--jup-text, #1e293b);
    line-height: 1.8;
    margin: 20px 0;
}

/* === Sidebar === */
.jup-sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--jup-sidebar-bg, #1e1b4b);
    color: #fff;
    position: relative;
    z-index: 10;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.jup-sidebar-inner {
    position: sticky;
    top: 0;
    padding: 24px 16px;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.jup-sidebar-inner::-webkit-scrollbar {
    width: 4px;
}

.jup-sidebar-inner::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

/* === User Card === */
.jup-user-card {
    text-align: center;
    padding: 24px 16px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.jup-avatar-wrap {
    position: relative;
    display: inline-block;
    margin-bottom: 12px;
}

.jup-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
    transition: transform 0.3s, border-color 0.3s;
}

.jup-avatar:hover {
    transform: scale(1.05);
    border-color: var(--jup-accent, #06b6d4);
}

.jup-avatar-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid var(--jup-sidebar-bg, #1e1b4b);
    animation: jup-pulse 2s infinite;
}

@keyframes jup-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}

.jup-user-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #fff;
}

.jup-user-email {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 6px;
    direction: ltr;
    unicode-bidi: plaintext;
}

.jup-user-since {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    display: inline-block;
    background: rgba(255, 255, 255, 0.08);
    padding: 3px 12px;
    border-radius: 20px;
}

/* === Navigation === */
.jup-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.jup-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.jup-nav-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--jup-primary, #6366f1), var(--jup-secondary, #8b5cf6));
    opacity: 0;
    border-radius: 12px;
    transition: opacity 0.25s ease;
}

.jup-nav-item:hover {
    color: #fff;
    text-decoration: none;
}

.jup-nav-item:hover::before {
    opacity: 0.15;
}

.jup-nav-active {
    color: #fff;
    background: linear-gradient(135deg, var(--jup-primary, #6366f1), var(--jup-secondary, #8b5cf6));
    box-shadow: 0 4px 15px rgba(var(--jup-primary-rgb, 99, 102, 241), 0.3);
}

.jup-nav-active::before {
    display: none;
}

.jup-nav-item i,
.jup-nav-item span {
    position: relative;
    z-index: 1;
}

.jup-nav-item i {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.jup-badge {
    margin-right: auto;
    margin-left: 0;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    min-width: 22px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.jup-nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 12px 0;
}

.jup-nav-logout {
    color: rgba(255, 255, 255, 0.5) !important;
}

.jup-nav-logout:hover {
    color: #ef4444 !important;
}

/* === Main Content === */
.jup-content {
    flex: 1;
    padding: 32px;
    overflow-x: hidden;
    min-width: 0;
}

/* === Welcome Section === */
.jup-welcome {
    background: linear-gradient(135deg, var(--jup-primary, #6366f1), var(--jup-secondary, #8b5cf6), var(--jup-accent, #06b6d4));
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 28px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.jup-welcome::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -25%;
    width: 150%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: jup-float 6s ease-in-out infinite;
}

@keyframes jup-float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

.jup-welcome-text {
    position: relative;
    z-index: 1;
}

.jup-welcome h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 8px;
    color: #fff;
}

.jup-welcome p {
    font-size: 14px;
    opacity: 0.85;
    color: #fff;
}

/* === Stats Cards === */
.jup-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.jup-stat-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #e2e8f0;
    position: relative;
    overflow: hidden;
}

.jup-stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 8px 8px 0;
}

.jup-stat-orders::after { background: var(--jup-primary, #6366f1); }
.jup-stat-spent::after { background: #22c55e; }
.jup-stat-pending::after { background: #f59e0b; }
.jup-stat-downloads::after { background: var(--jup-accent, #06b6d4); }

.jup-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.jup-stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.jup-stat-orders .jup-stat-icon { background: rgba(var(--jup-primary-rgb, 99, 102, 241), 0.1); color: var(--jup-primary, #6366f1); }
.jup-stat-spent .jup-stat-icon { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.jup-stat-pending .jup-stat-icon { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.jup-stat-downloads .jup-stat-icon { background: rgba(var(--jup-accent-rgb, 6, 182, 212), 0.1); color: var(--jup-accent, #06b6d4); }

.jup-stat-info {
    display: flex;
    flex-direction: column;
}

.jup-stat-number {
    font-size: 22px;
    font-weight: 800;
    color: var(--jup-text, #1e293b);
    line-height: 1.2;
}

.jup-stat-number .woocommerce-Price-amount {
    font-size: 18px;
}

.jup-stat-label {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
}

/* === Sections === */
.jup-section {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
}

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

.jup-section-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--jup-text, #1e293b);
}

.jup-view-all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--jup-primary, #6366f1);
    text-decoration: none;
    font-weight: 600;
    transition: gap 0.2s;
}

.jup-view-all:hover {
    gap: 10px;
    color: var(--jup-primary, #6366f1);
    text-decoration: none;
}

/* === Orders Table === */
.jup-orders-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.jup-orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.jup-orders-table thead th {
    text-align: right;
    padding: 12px 16px;
    font-weight: 600;
    color: #64748b;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #f1f5f9;
    white-space: nowrap;
}

.jup-orders-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f8fafc;
    vertical-align: middle;
}

.jup-orders-table tbody tr {
    transition: background 0.2s;
}

.jup-orders-table tbody tr:hover {
    background: #fafbfe;
}

.jup-order-num {
    font-weight: 700;
    color: var(--jup-primary, #6366f1);
}

.jup-order-total {
    font-weight: 600;
}

/* === Status Badges === */
.jup-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.jup-status-success {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.jup-status-info {
    background: rgba(var(--jup-primary-rgb, 99, 102, 241), 0.1);
    color: var(--jup-primary, #6366f1);
}

.jup-status-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.jup-status-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.jup-status-default {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
}

/* === Buttons === */
.jup-btn-sm {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: linear-gradient(135deg, var(--jup-primary, #6366f1), var(--jup-secondary, #8b5cf6));
    color: #fff !important;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.25s;
    border: none;
    cursor: pointer;
}

.jup-btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--jup-primary-rgb, 99, 102, 241), 0.3);
    color: #fff !important;
}

/* === Quick Access Cards === */
.jup-quick-access {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.jup-quick-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 16px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    text-decoration: none !important;
    color: var(--jup-text, #1e293b) !important;
    transition: all 0.3s;
    text-align: center;
}

.jup-quick-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(var(--jup-primary-rgb, 99, 102, 241), 0.12);
    border-color: var(--jup-primary, #6366f1);
    color: var(--jup-primary, #6366f1) !important;
}

.jup-quick-card i {
    font-size: 28px;
    color: var(--jup-primary, #6366f1);
    transition: transform 0.3s;
}

.jup-quick-card:hover i {
    transform: scale(1.15);
}

.jup-quick-card span {
    font-size: 13px;
    font-weight: 600;
}

/* === WooCommerce Content Area === */
.jup-wc-content {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.jup-content-header {
    padding: 24px 28px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfe;
}

.jup-content-header h2 {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--jup-text, #1e293b);
}

.jup-content-header h2 i {
    color: var(--jup-primary, #6366f1);
}

.jup-wc-inner {
    padding: 28px;
}

/* WooCommerce form overrides inside panel */
.jup-wc-inner .woocommerce-EditAccountForm input,
.jup-wc-inner .woocommerce-address-fields input,
.jup-wc-inner .woocommerce-EditAccountForm select,
.jup-wc-inner .woocommerce-address-fields select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.jup-wc-inner input:focus,
.jup-wc-inner select:focus {
    border-color: var(--jup-primary, #6366f1);
    box-shadow: 0 0 0 3px rgba(var(--jup-primary-rgb, 99, 102, 241), 0.1);
    outline: none;
}

.jup-wc-inner .woocommerce-Button,
.jup-wc-inner button[type="submit"] {
    background: linear-gradient(135deg, var(--jup-primary, #6366f1), var(--jup-secondary, #8b5cf6)) !important;
    color: #fff !important;
    border: none !important;
    padding: 12px 32px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.25s !important;
    font-family: inherit !important;
}

.jup-wc-inner .woocommerce-Button:hover,
.jup-wc-inner button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(var(--jup-primary-rgb, 99, 102, 241), 0.3);
}

/* WooCommerce notices */
.jup-wc-inner .woocommerce-message,
.jup-wc-inner .woocommerce-info {
    border-radius: 10px;
    border-right: 4px solid var(--jup-primary, #6366f1);
    border-left: none;
}

.jup-wc-inner .woocommerce-error {
    border-radius: 10px;
    border-right: 4px solid #ef4444;
    border-left: none;
}

/* Login notice */
.jup-login-notice {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.jup-login-notice p {
    font-size: 16px;
    color: #64748b;
}

/* === Mobile Header === */
.jup-mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--jup-sidebar-bg, #1e1b4b);
    color: #fff;
}

.jup-mobile-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.jup-mobile-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s;
}

.jup-mobile-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.jup-mobile-user img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.jup-mobile-user span {
    font-size: 14px;
    font-weight: 600;
}

/* === Overlay === */
.jup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s;
}

.jup-overlay.active {
    display: block;
    opacity: 1;
}

/* === Icons (SVG-based, no dependency) === */
[class^="jup-icon-"]::before,
[class*=" jup-icon-"]::before {
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}

.jup-icon-dashboard::before { content: '🏠'; }
.jup-icon-orders::before { content: '📦'; }
.jup-icon-downloads::before { content: '⬇️'; }
.jup-icon-address::before { content: '📍'; }
.jup-icon-account::before { content: '👤'; }
.jup-icon-wishlist::before { content: '❤️'; }
.jup-icon-logout::before { content: '🚪'; }
.jup-icon-wallet::before { content: '💰'; }
.jup-icon-pending::before { content: '⏳'; }
.jup-icon-arrow::before { content: '←'; }
.jup-icon-shop::before { content: '🛍️'; }

/* === Responsive === */

/* Tablet */
@media (max-width: 1024px) {
    .jup-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .jup-quick-access {
        grid-template-columns: repeat(2, 1fr);
    }

    .jup-sidebar {
        width: 250px;
        min-width: 250px;
    }

    .jup-content {
        padding: 24px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .jup-panel {
        flex-direction: column;
        border-radius: 0;
        min-height: auto;
    }

    .jup-mobile-header {
        display: flex;
    }

    .jup-sidebar {
        position: fixed;
        top: 0;
        right: -300px;
        width: 280px;
        min-width: 280px;
        height: 100vh;
        z-index: 100;
        transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .jup-sidebar.open {
        right: 0;
    }

    .jup-content {
        padding: 16px;
    }

    .jup-stats {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .jup-stat-card {
        padding: 16px;
    }

    .jup-stat-number {
        font-size: 18px;
    }

    .jup-stat-number .woocommerce-Price-amount {
        font-size: 15px;
    }

    .jup-quick-access {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .jup-welcome {
        padding: 24px 20px;
    }

    .jup-welcome h2 {
        font-size: 18px;
    }

    .jup-orders-table {
        font-size: 13px;
    }

    .jup-orders-table thead th,
    .jup-orders-table tbody td {
        padding: 10px 12px;
    }

    .jup-section {
        padding: 16px;
    }

    .jup-wc-inner {
        padding: 16px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .jup-stats {
        grid-template-columns: 1fr;
    }

    .jup-quick-access {
        grid-template-columns: 1fr;
    }

    .jup-stat-card {
        flex-direction: row;
        text-align: right;
    }
}

/* === WoodMart Compatibility Overrides === */
body.jup-active .woocommerce-MyAccount-navigation {
    display: none !important;
}

body.jup-active .woocommerce-MyAccount-content {
    width: 100% !important;
    float: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

body.jup-active .woocommerce-account .woocommerce {
    max-width: 100% !important;
}

/* Hide Woodmart default account elements */
body.jup-active .wd-my-account-wrapper,
body.jup-active .woodmart-my-account-sidebar,
body.jup-active .woocommerce-MyAccount-navigation-link {
    display: none !important;
}

/* === Print Styles === */
@media print {
    .jup-sidebar,
    .jup-mobile-header,
    .jup-quick-access {
        display: none !important;
    }

    .jup-content {
        padding: 0;
    }

    .jup-panel {
        box-shadow: none;
    }
}

/* === Animations === */
.jup-stat-card,
.jup-quick-card,
.jup-section {
    animation: jup-fadeUp 0.5s ease backwards;
}

.jup-stat-card:nth-child(1) { animation-delay: 0.1s; }
.jup-stat-card:nth-child(2) { animation-delay: 0.2s; }
.jup-stat-card:nth-child(3) { animation-delay: 0.3s; }
.jup-stat-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes jup-fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
