/* ===============================
   COMPREHENSIVE HEADER FUNCTIONALITY STYLES
   For both User View and Admin Dashboard
   =============================== */

/* ===============================
   HEADER PANELS COMMON STYLES
   =============================== */
.header-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.header-panel.active {
    opacity: 1;
    visibility: visible;
}

.panel-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.panel-content {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 400px;
    max-width: 90vw;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.header-panel.active .panel-content {
    transform: translateY(0);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.panel-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.panel-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.panel-body {
    padding: 1.5rem;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

/* ===============================
   NOTIFICATIONS PANEL
   =============================== */
.notifications-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    position: relative;
}

.notification-item:hover {
    background-color: #f8f9fa;
}

.notification-item.unread {
    background-color: #f0f8ff;
    border-left: 4px solid #007bff;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.notification-icon.info {
    background-color: #e3f2fd;
    color: #1976d2;
}

.notification-icon.success {
    background-color: #e8f5e8;
    color: #388e3c;
}

.notification-icon.warning {
    background-color: #fff3e0;
    color: #f57c00;
}

.notification-icon.error {
    background-color: #ffebee;
    color: #d32f2f;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.notification-message {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.notification-time {
    color: #9e9e9e;
    font-size: 0.8rem;
}

.notification-close {
    background: none;
    border: none;
    color: #9e9e9e;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    margin-left: 0.5rem;
}

.no-notifications {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.no-notifications svg {
    margin-bottom: 1rem;
}

/* ===============================
   SYSTEM ALERTS PANEL
   =============================== */
.alerts-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-item.info {
    background-color: #e3f2fd;
    border-left-color: #2196f3;
}

.alert-item.warning {
    background-color: #fff3e0;
    border-left-color: #ff9800;
}

.alert-item.error {
    background-color: #ffebee;
    border-left-color: #f44336;
}

.alert-item.critical {
    background-color: #fce4ec;
    border-left-color: #e91e63;
}

.alert-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.alert-message {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.alert-time {
    color: #9e9e9e;
    font-size: 0.8rem;
}

.alert-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.no-alerts {
    text-align: center;
    padding: 3rem 1rem;
    color: #28a745;
}

/* ===============================
   HELP PANEL
   =============================== */
.help-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.help-section {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
}

.help-section h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.help-section h5 {
    margin: 1rem 0 0.5rem 0;
    color: #495057;
    font-size: 1rem;
}

.help-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.help-item {
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    font-size: 0.9rem;
}

.help-item strong {
    color: #2c3e50;
}

.help-shortcuts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.help-shortcuts kbd {
    background-color: #e9ecef;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
}

.help-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.help-links a {
    color: #007bff;
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.help-links a:hover {
    background-color: #f8f9fa;
    text-decoration: underline;
}

.contact-info {
    font-size: 0.9rem;
    line-height: 1.6;
}

.contact-info p {
    margin: 0.5rem 0;
}

.contact-info strong {
    color: #2c3e50;
}

/* ===============================
   MARKETS PANEL
   =============================== */
.markets-panel {
    width: 500px;
}

.markets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.market-search .form-control {
    width: 200px;
}

.markets-tabs {
    display: flex;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    color: #6c757d;
}

.tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.tab-btn:hover {
    color: #007bff;
    background-color: #f8f9fa;
}

.markets-list {
    max-height: 400px;
    overflow-y: auto;
}

.market-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.market-item:hover {
    background-color: #f8f9fa;
}

.market-symbol {
    font-weight: 700;
    font-size: 1rem;
    color: #2c3e50;
    min-width: 80px;
}

.market-name {
    flex: 1;
    color: #6c757d;
    font-size: 0.9rem;
    margin: 0 1rem;
}

.market-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-right: 1rem;
    min-width: 100px;
}

.market-price.positive {
    color: #28a745;
}

.market-price.negative {
    color: #dc3545;
}

.market-change {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.market-actions {
    display: flex;
    gap: 0.5rem;
}

.market-actions .btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
}

/* ===============================
   ACCOUNT TYPES PANEL
   =============================== */
.account-types {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.account-type-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.account-type-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.account-type-card .card-header {
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.account-type-card.demo .card-header {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.card-header h5 {
    margin: 0;
    font-size: 1.1rem;
}

.badge.free {
    background-color: #28a745;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge.premium {
    background-color: #ffc107;
    color: #212529;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.card-content {
    padding: 1.5rem;
}

.card-content ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
}

.card-content li {
    padding: 0.5rem 0;
    color: #6c757d;
    position: relative;
    padding-left: 1.5rem;
}

.card-content li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.comparison-table th,
.comparison-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.comparison-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

/* ===============================
   AUTH PANEL
   =============================== */
.auth-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.auth-tab {
    background: none;
    border: none;
    padding: 1rem 2rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    color: #6c757d;
    font-weight: 500;
}

.auth-tab.active {
    color: #007bff;
    border-bottom-color: #007bff;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h4 {
    margin: 0 0 1.5rem 0;
    color: #2c3e50;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #495057;
    font-weight: 500;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-label input {
    margin-right: 0.5rem;
}

.auth-links {
    text-align: center;
    margin-top: 1rem;
}

.auth-links a {
    color: #007bff;
    text-decoration: none;
    font-size: 0.9rem;
}

/* ===============================
   BALANCE DETAILS PANEL
   =============================== */
.balance-details {
    width: 450px;
}

.balance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.balance-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.balance-card {
    padding: 1.5rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.2s ease;
}

.balance-card:hover {
    transform: translateY(-2px);
}

.balance-card.main {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.balance-label {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.balance-card.main .balance-label {
    color: rgba(255, 255, 255, 0.8);
}

.balance-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

.balance-card.main .balance-amount {
    color: white;
    font-size: 2rem;
}

.balance-change {
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.balance-change.positive {
    color: #28a745;
}

.balance-change.negative {
    color: #dc3545;
}

.balance-card.main .balance-change {
    color: rgba(255, 255, 255, 0.9);
}

.balance-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

/* ===============================
   ACTIVE USERS & TRANSACTIONS
   =============================== */
.users-header,
.transactions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.user-item,
.transaction-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: background-color 0.2s ease;
}

.user-item:hover,
.transaction-item:hover {
    background-color: #f8f9fa;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 1rem;
}

.user-info,
.transaction-info {
    flex: 1;
}

.user-name,
.transaction-type {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.user-activity,
.transaction-amount {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.transaction-amount {
    font-weight: 600;
    color: #28a745;
}

.user-login-time,
.transaction-user,
.transaction-time {
    color: #9e9e9e;
    font-size: 0.8rem;
}

.user-status {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: capitalize;
}

.user-status.trading {
    background-color: #d1ecf1;
    color: #0c5460;
}

.user-status.browsing {
    background-color: #d4edda;
    color: #155724;
}

.user-status.managing {
    background-color: #fff3cd;
    color: #856404;
}

.transaction-actions {
    display: flex;
    gap: 0.5rem;
}

/* ===============================
   NOTIFICATION TOASTS
   =============================== */
.toast-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 10001;
}

.notification-toast {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    margin-bottom: 0.75rem;
    min-width: 300px;
    max-width: 400px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    border-left: 4px solid;
}

.notification-toast.show {
    transform: translateX(0);
}

.notification-toast.info {
    border-left-color: #007bff;
}

.notification-toast.success {
    border-left-color: #28a745;
}

.notification-toast.warning {
    border-left-color: #ffc107;
}

.notification-toast.error {
    border-left-color: #dc3545;
}

.toast-icon {
    font-size: 1.2rem;
    margin-right: 0.75rem;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.toast-message {
    color: #6c757d;
    font-size: 0.9rem;
}

.toast-close {
    background: none;
    border: none;
    color: #9e9e9e;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    margin-left: 0.5rem;
}

/* ===============================
   TOOLTIPS
   =============================== */
.header-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10002;
    pointer-events: none;
}

.header-tooltip::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid rgba(0, 0, 0, 0.8);
}

/* ===============================
   RESPONSIVE DESIGN
   =============================== */
@media (max-width: 768px) {
    .panel-content {
        width: 95vw;
        right: 2.5vw;
        max-height: calc(100vh - 120px);
    }

    .markets-panel,
    .balance-details {
        width: 100%;
    }

    .account-types {
        grid-template-columns: 1fr;
    }

    .balance-cards {
        grid-template-columns: 1fr;
    }

    .markets-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .market-search .form-control {
        width: 100%;
    }

    .markets-tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1;
        min-width: 0;
    }

    .market-item {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .market-actions {
        justify-content: center;
        margin-top: 1rem;
    }

    .notification-toast {
        min-width: 280px;
        max-width: 90vw;
    }

    .toast-container {
        right: 5vw;
        left: 5vw;
    }
}

/* ===============================
   ANIMATION KEYFRAMES
   =============================== */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Apply animations */
.header-panel {
    animation: fadeIn 0.3s ease;
}

.notification-toast {
    animation: slideIn 0.3s ease;
}

.user-view-badge {
    animation: pulse 2s infinite;
}
