/* Account System Styles */

/* Modal Overlay */
.account-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal Content */
.account-modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    width: 90%;
    position: relative;
    animation: slideIn 0.3s ease;
}

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

/* Custom scrollbar for modal */
.account-modal-content::-webkit-scrollbar {
    width: 8px;
}

.account-modal-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.account-modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

.account-modal-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Close Button */
.account-close-button {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s;
}

.account-close-button:hover {
    color: #fff;
}

/* Form Styles */
.account-form {
    color: #fff;
}

.account-form h2 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #ffd700;
    text-align: center;
    font-size: 28px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.account-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #444;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.3s, background 0.3s;
}

.account-form input:focus {
    outline: none;
    border-color: #ffd700;
    background: rgba(255, 255, 255, 0.1);
}

.account-form input::placeholder {
    color: #888;
}

/* Buttons */
.account-button {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #000;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.account-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
}

.account-button:active {
    transform: translateY(0);
}

.logout-button {
    background: linear-gradient(135deg, #dc3545 0%, #ff4757 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.logout-button:hover {
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.5);
}

.cancel-button {
    background: linear-gradient(135deg, #6c757d 0%, #868e96 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.cancel-button:hover {
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.5);
}

/* Error Messages */
.account-error {
    color: #ff4757;
    margin-top: 10px;
    font-size: 14px;
    text-align: center;
    min-height: 20px;
}

/* Switch Text */
.account-switch {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    color: #aaa;
}

.account-switch a {
    color: #ffd700;
    text-decoration: none;
    font-weight: bold;
}

.account-switch a:hover {
    text-decoration: underline;
}

/* Profile View */
.profile-data {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.profile-data p {
    margin: 10px 0;
    font-size: 16px;
}

.profile-data h3 {
    color: #ffd700;
    margin-top: 15px;
    margin-bottom: 10px;
}

/* Role Badges */
.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 🟠 Free - Orange */
.role-free {
    background: linear-gradient(135deg, #ff8c00 0%, #ff6b00 100%);
    color: #fff;
}

/* 🟢 Plus - Green */
.role-plus {
    background: linear-gradient(135deg, #00c851 0%, #00a040 100%);
    color: #fff;
}

/* 🟣 Premium - Purple */
.role-premium {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: #fff;
}

/* 🔵 Dev - Cyan/Light Blue (bypasses monetization) */
.role-dev {
    background: linear-gradient(135deg, #00d4ff 0%, #00a8cc 100%);
    color: #000;
}

/* 🟣 Admin - Darker Purple/Gold (highest level) */
.role-admin {
    background: linear-gradient(135deg, #6b2d8f 0%, #4a1f66 100%);
    color: #ffd700;
    border: 2px solid #ffd700;
}

/* Notifications */
.account-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.account-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* Account Button in Header - trimmed in royal purple */
.header-account-stack {
    position: fixed;
    top: max(20px, calc(10px + env(safe-area-inset-top, 0px)));
    right: max(20px, env(safe-area-inset-right, 0px));
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    z-index: 9999;
    max-width: min(240px, calc(100vw - 24px));
}

.account-header-button {
    position: static;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: 2px solid #6a0dad;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.account-header-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(106, 13, 173, 0.5);
}

.account-header-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.account-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.account-status-dot.online {
    background: #4CAF50;
    box-shadow: 0 0 6px #4CAF50;
}
.account-status-dot.offline {
    background: #f44336;
    box-shadow: 0 0 4px rgba(244, 67, 54, 0.5);
}

/* Persona Management */
.persona-description {
    text-align: center;
    color: #aaa;
    margin-bottom: 20px;
    font-size: 14px;
}

.no-personas {
    text-align: center;
    color: #aaa;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 20px;
}

.personas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.persona-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #444;
    border-radius: 10px;
    padding: 15px;
    position: relative;
    transition: all 0.3s;
}

.persona-card:hover {
    border-color: #ffd700;
    transform: translateY(-2px);
}

.persona-card.active-persona {
    border-color: #00ff00;
    background: rgba(0, 255, 0, 0.1);
}

.persona-card h3 {
    margin: 0 0 5px 0;
    color: #ffd700;
    font-size: 18px;
}

.persona-username {
    color: #888;
    font-size: 14px;
    margin: 0 0 10px 0;
}

.active-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #00ff00;
    color: #000;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: bold;
}

.persona-stats {
    margin: 15px 0;
    font-size: 13px;
}

.persona-stats p {
    margin: 5px 0;
    color: #aaa;
}

.persona-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.mini-button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.mini-button.activate-persona {
    background: linear-gradient(135deg, #00ff00 0%, #00cc00 100%);
    color: #000;
    font-weight: bold;
}

.mini-button.delete-persona {
    background: linear-gradient(135deg, #dc3545 0%, #ff4757 100%);
    color: #fff;
}

.mini-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Leaderboard */
.leaderboard-table {
    max-height: 500px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 20px;
}

.leaderboard-table table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
    padding: 12px;
    text-align: left;
    position: sticky;
    top: 0;
    font-size: 14px;
}

.leaderboard-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #333;
    color: #fff;
    font-size: 14px;
}

.leaderboard-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.leaderboard-table tr:nth-child(1) td {
    background: rgba(255, 215, 0, 0.1);
}

.leaderboard-table tr:nth-child(2) td {
    background: rgba(192, 192, 192, 0.1);
}

.leaderboard-table tr:nth-child(3) td {
    background: rgba(205, 127, 50, 0.1);
}

/* Notifications System - olive green */
.notifications-button {
    position: static;
    padding: 8px 12px;
    background: linear-gradient(135deg, #6b8e23 0%, #556b2f 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(107, 142, 35, 0.3);
}

.notifications-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(107, 142, 35, 0.5);
    background: linear-gradient(135deg, #7a9e2d 0%, #657a35 100%);
}

.notifications-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid #1a1a2e;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.notification-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    background: linear-gradient(135deg, #6b8e23 0%, #556b2f 100%);
    color: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(107, 142, 35, 0.4);
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-out;
    max-width: 300px;
    font-size: 14px;
    border: 2px solid rgba(107, 142, 35, 0.5);
}

.notification-toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* Notifications Panel (Centered Popup) */
.notifications-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10100;
    opacity: 0;
    transition: opacity 0.3s;
}

.notifications-panel.show {
    opacity: 1;
}

.notifications-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 2px solid rgba(107, 142, 35, 0.4);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.notifications-panel.show .notifications-content {
    transform: scale(1);
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid rgba(138, 43, 226, 0.3);
    background: rgba(106, 13, 173, 0.1);
}

.notifications-header h2 {
    margin: 0;
    color: #fff;
    font-size: 24px;
}

.close-notifications-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-notifications-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.notifications-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.no-notifications {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-size: 16px;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    margin-bottom: 15px;
    border: 2px solid rgba(138, 43, 226, 0.2);
    transition: all 0.2s;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(138, 43, 226, 0.4);
    transform: translateX(5px);
}

.notification-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

.notification-message {
    font-size: 14px;
    color: #ccc;
    margin-bottom: 8px;
}

.notification-message strong {
    color: #8a2be2;
}

.notification-time {
    font-size: 12px;
    color: #888;
}

.notification-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.accept-notification-btn,
.decline-notification-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

.accept-notification-btn {
    background: linear-gradient(135deg, #00ff88 0%, #00cc66 100%);
    color: #000;
}

.accept-notification-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.4);
}

.decline-notification-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.decline-notification-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .account-modal-content {
        padding: 30px 20px;
        max-width: 95%;
    }

    .account-form h2 {
        font-size: 24px;
    }

    .account-notification {
        right: 10px;
        left: 10px;
        top: 10px;
    }

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

    .leaderboard-table {
        font-size: 12px;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 6px;
    }

    .header-account-stack {
        top: max(14px, calc(8px + env(safe-area-inset-top, 0px)));
        right: 12px;
        max-width: min(200px, calc(100vw - 80px));
    }

    .account-header-button {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .notifications-button {
        padding: 6px 10px;
        font-size: 15px;
    }
    
    .notification-toast {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .notifications-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .notification-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .notification-actions {
        width: 100%;
    }
    
    .accept-notification-btn,
    .decline-notification-btn {
        flex: 1;
    }
}
