/* Referral System & Layout Extensions */

/* --- Animations --- */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* --- Notification System --- */
.notification-container {
    position: relative;
    display: flex;
    align-items: center;
}

.notification-bell-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    text-decoration: none;
}

#notificationBadge {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    background: #FF3B30;
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

#notificationDropdown {
    display: none;
    width: 320px;
    padding: 0;
    margin-top: 8px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: absolute;
    right: -60px;
    top: 100%;
    background: white;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid #f0f0f0;
}

.notification-header {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header-title {
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.notification-mark-read {
    font-size: 12px;
    color: #2980B9;
    text-decoration: none;
}

#notificationList {
    max-height: 360px;
    overflow-y: auto;
}

.notification-empty {
    padding: 24px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

.notification-footer {
    padding: 8px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.notification-view-all {
    font-size: 13px;
    color: #666;
    text-decoration: none;
    display: block;
    padding: 4px;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: #fafafa !important;
}

/* --- Profile Dropdown (New Design) --- */
#profileDropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.profile-avatar-btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#profileDropdownMenu {
    display: none;
    width: 320px;
    padding: 4px;
    background: var(--Background-White, white);
    box-shadow: 0px 4px 6px -4px rgba(0, 0, 0, 0.30);
    border-radius: 8px;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 1000;
}

.profile-menu-header {
    align-self: stretch;
    padding: 8px 12px;
    background: var(--Background-White, white);
    border-radius: 4px;
    justify-content: flex-start;
    align-items: center;
    display: flex;
    gap: 8px;
}

.profile-menu-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#accountTypeBadge {
}

.profile-avatar-circle {
    width: 32px;
    height: 32px;
    padding: 4px;
    background: var(--Background-Blue, #E5EFF7);
    border-radius: 30px;
    justify-content: center;
    align-items: center;
    gap: 10px;
    display: flex;
}

.profile-avatar-circle.account-ring-normal {
    background: #f9fafb;
    border: 2px solid #d1d5db;
}

.profile-avatar-circle.account-ring-pro {
    background: #ecfdf5;
    border: 2px solid #34d399;
}

.profile-avatar-circle.account-ring-vip {
    background: #f5f3ff;
    border: 2px solid #a78bfa;
}

.profile-avatar-circle.account-ring-guest {
    background: #f9fafb;
    border: 2px solid #d1d5db;
}

.profile-username {
    font-size: 14px;
    font-family: Roboto;
    font-weight: 500;
    word-wrap: break-word;
}

.profile-name-normal { color: #4b5563; }
.profile-name-pro { color: #047857; }
.profile-name-vip { color: #6d28d9; }
.profile-name-guest { color: #9ca3af; }

.profile-expiry {
    color: #9ca3af;
    font-size: 12px;
    font-family: Roboto;
    font-weight: 400;
}

.profile-stats-row {
    align-self: stretch;
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 4px;
    padding-bottom: 4px;
    border-radius: 4px;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    display: inline-flex;
}

.profile-icon-box {
    width: 32px;
    height: 32px;
    justify-content: center;
    align-items: center;
    gap: 10px;
    display: flex;
}

.profile-menu-item {
    align-self: stretch;
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 4px;
    padding-bottom: 4px;
    border-radius: 4px;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    display: inline-flex;
    cursor: pointer;
}

.profile-menu-item:hover {
    background-color: #f5f5f5 !important;
}

.profile-menu-text {
    color: var(--Text-Text-Primary, black);
    font-size: 14px;
    font-family: Roboto;
    font-weight: 400;
    word-wrap: break-word;
}

.profile-ref-count {
    color: var(--colorLink, #1677FF);
    font-size: 14px;
    font-family: Roboto;
    font-weight: 500;
    word-wrap: break-word;
}

/* --- Referral Toast --- */
#referralToast {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, #2980B9, #1a5f8a);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 10000;
    font-family: Roboto;
    max-width: 320px;
    animation: slideInRight 0.4s ease;
}

.referral-toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.referral-toast-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.referral-toast-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.referral-toast-close:hover {
    opacity: 1;
}

/* --- Referral Link Dialog --- */
#refLinkDialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10001;
    justify-content: center;
    align-items: center;
    font-family: 'Roboto', sans-serif;
}

.ref-dialog-container {
    width: 412px;
    height: auto;
    background: var(--Background-Elevated, white);
    box-shadow: 0px 9px 28px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border-radius: 8px;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    display: inline-flex;
    position: relative;
}

.ref-dialog-header {
    align-self: stretch;
    padding-top: 12px;
    padding-bottom: 8px;
    padding-left: 16px;
    padding-right: 16px;
    border-bottom: 1px var(--Border-Stroke-1, #F0F0F0) solid;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    display: inline-flex;
}

.ref-dialog-title {
    flex: 1 1 0;
    color: var(--Text-Text-88, rgba(0, 0, 0, 0.88));
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
    word-wrap: break-word;
}

.ref-dialog-close {
    width: 24px;
    height: 24px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ref-dialog-body {
    align-self: stretch;
    padding-left: 16px;
    padding-right: 16px;
    padding-top: 12px;
    padding-bottom: 12px;
    justify-content: flex-start;
    align-items: center;
    display: inline-flex;
}

.ref-dialog-content-wrapper {
    flex: 1 1 0;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 4px;
    display: inline-flex;
}

.ref-dialog-label-row {
    align-self: stretch;
    justify-content: flex-start;
    align-items: center;
    gap: 4px;
    display: inline-flex;
}

.ref-dialog-label {
    color: var(--Text-Text-Primary, black);
    font-size: 12px;
    font-family: Roboto;
    font-weight: 500;
    word-wrap: break-word;
}

.ref-dialog-input-container {
    align-self: stretch;
    padding-left: 12px;
    padding-right: 12px;
    background: var(--Background-Container-Disabled, rgba(0, 0, 0, 0.04));
    overflow: hidden;
    border-radius: 4px;
    outline: 1px var(--Border-Border-2, #D9D9D9) solid;
    outline-offset: -1px;
    justify-content: flex-start;
    align-items: center;
    display: inline-flex;
}

.ref-dialog-input-inner {
    flex: 1 1 0;
    height: 32px;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    display: flex;
}

.ref-dialog-input-wrapper {
    flex: 1 1 0;
    justify-content: center;
    display: flex;
    flex-direction: column;
    color: var(--Text-Text-Primary, black);
    font-size: 14px;
    font-family: Roboto;
    font-weight: 400;
    word-wrap: break-word;
}

#refLinkInput {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    padding: 0;
    margin: 0;
    font-family: Roboto;
    font-size: 14px;
    font-weight: 400;
    color: inherit;
}

.ref-dialog-link-row {
    align-self: stretch;
    padding-top: 2px;
    justify-content: flex-start;
    align-items: center;
    display: inline-flex;
}

.ref-dialog-link {
    flex: 1 1 0;
    color: var(--colorLink, #1677FF);
    font-size: 14px;
    font-family: Roboto;
    font-weight: 400;
    word-wrap: break-word;
    text-decoration: none;
}

.ref-dialog-footer {
    align-self: stretch;
    padding-top: 8px;
    padding-bottom: 12px;
    padding-left: 16px;
    padding-right: 16px;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    display: inline-flex;
}

#copyRefBtn {
    height: 32px;
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 8px;
    padding-bottom: 8px;
    background: var(--Primary-Brand, #2980B9);
    border-radius: 4px;
    justify-content: center;
    align-items: center;
    gap: 8px;
    display: flex;
    cursor: pointer;
    transition: background 0.2s;
}

#copyRefBtn:hover {
    background: #1a5f8a;
}

#copyRefBtn:mouseout {
    background: #2980B9;
}

.copy-btn-inner {
    justify-content: center;
    align-items: center;
    gap: 8px;
    display: flex;
}

.copy-btn-text {
    text-align: center;
    justify-content: center;
    display: flex;
    flex-direction: column;
    color: var(--Text-Text-White, white);
    font-size: 14px;
    font-weight: 400;
    line-height: 22px;
    word-wrap: break-word;
}

#refLinkLoading {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
    align-items: center;
    justify-content: center;
}

/* --- Account Tier Badge & Progress --- */
.account-badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.account-tier-normal {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.account-tier-pro {
    background: #d1fae5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.account-tier-vip {
    background: #ede9fe;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
}

.account-tier-guest {
    background: #f3f4f6;
    color: #9ca3af;
    border: 1px solid #e5e7eb;
}

.account-progress-section {
    align-self: stretch;
    padding: 8px 12px;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    margin: 4px 0;
}

.account-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 12px;
    color: #666;
}

.account-progress-bar-bg {
    width: 100%;
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
}

.account-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2980B9, #1a5f8a);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.account-upgrade-btn {
    align-self: stretch;
    margin: 4px 12px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #2980B9, #1a5f8a);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: opacity 0.2s;
}

.account-upgrade-btn:hover {
    opacity: 0.9;
}

.account-upgrade-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.account-expiry-text {
    align-self: stretch;
    padding: 4px 12px;
    font-size: 12px;
    color: #666;
    text-align: center;
}

.account-expiry-text strong {
    color: #2980B9;
}
.account-expiry-inline {
    margin-left: 6px;
    color: #666;
    font-size: 11px;
    font-weight: 400;
}
