/* ===================================
   RYCART PREMIUM STYLES
   =================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores RyCart */
    --rycart-blue: #2184D6;
    --rycart-blue-dark: #0d1f2d;
    --rycart-blue-medium: #1a3a52;
    --rycart-blue-light: #4fa3e8;
    --rycart-orange: #FF6A00;
    --rycart-orange-dark: #e65f00;
    
    /* Espaciado */
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: white;
    overflow-x: hidden;
    background: var(--rycart-blue-dark);
}

/* ===================================
   HEADER PREMIUM
   =================================== */
.portal-navbar {
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    background: rgba(13, 31, 45, 0.98);
    backdrop-filter: blur(20px);
    border-bottom: 3px solid var(--rycart-orange);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.portal-navbar .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 50px;
    height: 50px;
    filter: drop-shadow(0 2px 8px rgba(255, 106, 0, 0.4));
}

.brand-text {
    font-size: 32px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--rycart-orange), white);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.navbar-menu {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-lang {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--rycart-orange);
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.btn-lang:hover {
    background: rgba(255, 106, 0, 0.2);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--rycart-orange), var(--rycart-orange-dark));
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 106, 0, 0.4);
}

/* ===================================
   MAIN CONTENT
   =================================== */
.portal-main {
    padding-top: 100px;
    min-height: 100vh;
    background: linear-gradient(135deg, #0d1f2d 0%, #1a3a52 50%, #2184D6 100%);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
}

/* ===================================
   WELCOME SECTION
   =================================== */
.welcome-section {
    text-align: center;
    padding: 60px 20px;
    position: relative;
}

.welcome-section::before {
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    left: -25%;
    top: -25%;
    background: radial-gradient(circle, rgba(255,106,0,0.08) 0%, transparent 70%);
    animation: rotate 30s linear infinite;
    pointer-events: none;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.welcome-section h1 {
    font-size: clamp(36px, 6vw, 64px);
    font-weight: 900;
    color: white;
    margin-bottom: 10px;
    text-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 20px;
    color: white;
    margin-top: 10px;
}

.badge {
    display: inline-block;
    background: rgba(255, 106, 0, 0.15);
    border: 2px solid var(--rycart-orange);
    padding: 8px 20px;
    border-radius: 50px;
    color: var(--rycart-orange);
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 14px;
    text-transform: uppercase;
}

/* ===================================
   STATS CARDS
   =================================== */
.stats-section {
    padding: 40px 0 60px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 25px;
}

.stat-card {
    background: rgba(13, 31, 45, 0.85);
    backdrop-filter: blur(10px);
    border: 2px solid var(--rycart-orange);
    border-radius: 20px;
    padding: 30px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,106,0,0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s;
}

.stat-card:hover {
    transform: translateY(-10px);
    border-color: var(--rycart-orange);
    box-shadow: 0 20px 50px rgba(255, 106, 0, 0.3);
}

.stat-card:hover::before {
    top: -100%;
    right: 100%;
}

.stat-icon {
    font-size: 40px;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 8px rgba(255, 106, 0, 0.3));
}

.stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    font-weight: 600;
}

.stat-value {
    font-size: 36px;
    font-weight: 900;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

/* ===================================
   REFERRAL CODE SECTION
   =================================== */
.referral-section {
    padding: 30px 0;
}

.card {
    background: rgba(13, 31, 45, 0.85);
    backdrop-filter: blur(10px);
    border: 2px solid var(--rycart-orange);
    border-radius: 20px;
    padding: 40px;
}

.card h2 {
    color: white;
    font-size: 28px;
    margin-bottom: 30px;
    text-align: center;
}

.referral-code-container {
    text-align: center;
}

.referral-code {
    background: linear-gradient(135deg, var(--rycart-orange), var(--rycart-orange-dark));
    color: white;
    font-size: 48px;
    font-weight: 900;
    padding: 30px;
    border-radius: 15px;
    letter-spacing: 8px;
    margin-bottom: 30px;
    box-shadow: 0 10px 40px rgba(255, 106, 0, 0.4);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.referral-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary, .btn-success {
    padding: 15px 35px;
    border-radius: 50px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--rycart-orange), var(--rycart-orange-dark));
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
}

.btn-primary:hover, .btn-success:hover, .btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* ===================================
   NETWORK SECTION
   =================================== */
.network-section {
    padding: 30px 0;
}

.network-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.tab-btn {
    background: rgba(13, 31, 45, 0.9);
    border: 2px solid var(--rycart-orange);
    color: white;
    padding: 12px 30px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: rgba(255, 106, 0, 0.3);
    border-color: var(--rycart-orange);
}

.tab-btn.active {
    background: var(--rycart-orange);
    border-color: var(--rycart-orange);
    box-shadow: 0 5px 20px rgba(255, 106, 0, 0.4);
}

.network-content {
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.network-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 30px;
    width: 100%;
    padding: 20px;
}

/* ===================================
   CÍRCULOS DE PARTNERS
   =================================== */
.referral-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a3a52, var(--rycart-blue));
    border: 4px solid var(--rycart-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: circle-fade-in 0.6s ease backwards;
}

@keyframes circle-fade-in {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.referral-circle:hover {
    transform: translateY(-10px) scale(1.1);
    border-color: white;
    box-shadow: 0 20px 50px rgba(255, 106, 0, 0.5);
}

.referral-initials {
    font-size: 32px;
    font-weight: 900;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.referral-level-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--rycart-orange);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 900;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.referral-status {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.referral-status.active {
    background: #25D366;
}

.referral-status.pending {
    background: #FFA500;
}

.referral-status.inactive {
    background: #DC3545;
}

/* ===================================
   TARJETA DE PARTNER (EXPANDIDA)
   =================================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

.partner-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, #1a3a52, var(--rycart-blue));
    border: 3px solid var(--rycart-orange);
    border-radius: 25px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    z-index: 9999;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.partner-card.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.partner-card-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.partner-card-close:hover {
    background: var(--rycart-orange);
    transform: rotate(90deg);
}

.partner-card-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.partner-card-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rycart-orange), var(--rycart-orange-dark));
    border: 4px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 900;
    color: white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.partner-card-info {
    flex: 1;
}

.partner-card-name {
    font-size: 24px;
    font-weight: 900;
    color: white;
    margin-bottom: 5px;
}

.partner-card-email {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.partner-card-level {
    display: inline-block;
    background: var(--rycart-orange);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-top: 5px;
}

.partner-card-body {
    color: white;
}

.partner-info-section {
    margin-bottom: 20px;
}

.partner-info-label {
    font-size: 12px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 1px;
    margin-bottom: 5px;
    font-weight: 600;
}

.partner-info-value {
    font-size: 16px;
    font-weight: 700;
    color: white;
}

.partner-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.partner-stat-item {
    background: rgba(13, 31, 45, 0.9);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255, 106, 0, 0.3);
}

.partner-stat-label {
    font-size: 11px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.partner-stat-value {
    font-size: 20px;
    font-weight: 900;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* ===================================
   COMMISSIONS TABLE
   =================================== */
.commissions-section {
    padding: 30px 0 60px;
}

.commissions-content {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    background: rgba(13, 31, 45, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    overflow: hidden;
    border: 2px solid var(--rycart-orange);
}

.data-table thead {
    background: rgba(255, 106, 0, 0.9);
}

.data-table th {
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    padding: 20px;
    text-align: left;
}

.data-table td {
    color: white;
    padding: 18px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.data-table tbody tr {
    transition: all 0.3s ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 106, 0, 0.2);
}

.badge-success {
    background: #25D366;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.badge-warning {
    background: #FFA500;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

/* ===================================
   LOADING & TOAST
   =================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 31, 45, 0.98);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    flex-direction: column;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--rycart-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    color: white;
    font-size: 18px;
    margin-top: 20px;
    font-weight: 600;
}

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: rgba(13, 31, 45, 0.95);
    color: white;
    padding: 18px 30px;
    border-radius: 50px;
    border: 2px solid var(--rycart-orange);
    font-weight: 700;
    z-index: 10001;
    transform: translateY(200px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: #25D366;
    border-color: #128C7E;
}

.toast.error {
    background: #DC3545;
    border-color: #c82333;
}

.empty-state {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    padding: 40px;
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 768px) {
    .portal-navbar .container {
        padding: 15px 20px;
    }

    .brand-text {
        font-size: 24px;
    }

    .container {
        padding: 0 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .network-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 20px;
    }

    .referral-circle {
        width: 90px;
        height: 90px;
    }

    .referral-initials {
        font-size: 24px;
    }

    .partner-card {
        width: 95%;
        padding: 30px 20px;
    }

    .partner-stats-row {
        grid-template-columns: 1fr;
    }

    .referral-actions {
        flex-direction: column;
    }

    .btn-primary, .btn-success, .btn-secondary {
        width: 100%;
    }

    .data-table {
        font-size: 14px;
    }

    .data-table th, .data-table td {
        padding: 12px;
    }
}