/**
 * Quarter Results Notification System Styles
 * Professional notification components and interfaces
 */

/* ========================================
   CSS Variables
   ======================================== */

:root {
    /* Notification Colors */
    --notification-primary: #3b82f6;
    --notification-success: #10b981;
    --notification-warning: #f59e0b;
    --notification-error: #ef4444;
    --notification-info: #6366f1;

    /* Notification Backgrounds */
    --notification-bg: #ffffff;
    --notification-bg-hover: #f8fafc;
    --notification-border: #e5e7eb;
    --notification-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);

    /* Text Colors */
    --notification-text: #1f2937;
    --notification-text-muted: #6b7280;
    --notification-text-light: #9ca3af;

    /* Badge Colors */
    --badge-unread: #dc2626;
    --badge-unread-bg: #fef2f2;
}

/* ========================================
   Notification Center
   ======================================== */

.notification-center {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 400px;
    max-height: 600px;
    background: var(--notification-bg);
    border: 1px solid var(--notification-border);
    border-radius: 12px;
    box-shadow: var(--notification-shadow), 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.notification-center.show {
    display: flex;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-header {
    padding: 20px;
    border-bottom: 1px solid var(--notification-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--notification-bg);
}

.notification-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--notification-text);
}

.notification-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--notification-text-muted);
}

.btn-icon:hover {
    background: var(--notification-bg-hover);
    color: var(--notification-text);
}

/* Notification Filters */
.notification-filters {
    padding: 16px 20px;
    border-bottom: 1px solid var(--notification-border);
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.filter-btn {
    padding: 6px 12px;
    border: 1px solid var(--notification-border);
    background: var(--notification-bg);
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    color: var(--notification-text-muted);
}

.filter-btn:hover {
    background: var(--notification-bg-hover);
}

.filter-btn.active {
    background: var(--notification-primary);
    color: white;
    border-color: var(--notification-primary);
}

/* Notification List */
.notification-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

.notification-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--notification-border);
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.notification-item:hover {
    background: var(--notification-bg-hover);
}

.notification-item.unread {
    background: var(--notification-bg);
    border-left: 3px solid var(--notification-primary);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    top: 18px;
    left: 8px;
    width: 8px;
    height: 8px;
    background: var(--badge-unread);
    border-radius: 50%;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.notification-icon.earnings {
    background: #dbeafe;
    color: var(--notification-primary);
}

.notification-icon.price-alert {
    background: #fef3c7;
    color: var(--notification-warning);
}

.notification-icon.market-news {
    background: #ecfdf5;
    color: var(--notification-success);
}

.notification-icon.system {
    background: #f3f4f6;
    color: var(--notification-text-muted);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    color: var(--notification-text);
    margin-bottom: 4px;
    font-size: 0.875rem;
    line-height: 1.4;
}

.notification-message {
    color: var(--notification-text-muted);
    font-size: 0.8125rem;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--notification-text-light);
}

.notification-item-actions {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    flex-shrink: 0;
}

.btn-mark-read, .btn-delete {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    font-size: 0.75rem;
}

.notification-item:hover .btn-mark-read,
.notification-item:hover .btn-delete {
    opacity: 1;
}

.btn-mark-read:hover {
    background: var(--notification-success);
    color: white;
}

.btn-delete:hover {
    background: var(--notification-error);
    color: white;
}

/* No Notifications State */
.no-notifications {
    padding: 40px 20px;
    text-align: center;
    color: var(--notification-text-muted);
}

.no-notifications-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-notifications h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 600;
}

.no-notifications p {
    margin: 0;
    font-size: 0.875rem;
}

/* ========================================
   Notification Bell/Trigger
   ======================================== */

/* Notification Bell Container */
.notification-bell-container {
    display: inline-flex;
    align-items: center;
    margin-right: 1rem;
    position: relative;
    z-index: 10;
}

/* Base Notification Bell Styles */
.notification-bell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--background-alt, #f8fafc);
    color: var(--primary, #0052cc);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 4px;
}

.notification-bell:hover {
    background-color: var(--primary, #0052cc);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
}

.notification-bell .bell-icon {
    width: 20px;
    height: 20px;
}

/* Guest Notification Bell Styles */
.notification-bell.guest-notification {
    background-color: var(--background-alt, #f8fafc);
    color: #ff4757;
}

.notification-bell.guest-notification:hover {
    background-color: #ff4757;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(255, 71, 87, 0.3);
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--primary, #0052cc);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    min-width: 18px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    padding: 0;
}

.notification-badge.guest-badge {
    background: #ff4757;
    animation: pulse 2s infinite;
}

.notification-badge.hidden {
    display: none;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Responsive Design */
@media (min-width: 992px) {
    .notification-bell-container {
        display: inline-flex;
    }
}

@media (max-width: 991px) {
    .nav-links {
        display: none;
    }
    .nav-links.show .notification-bell-container {
        display: flex;
    }
}

/* ========================================
   Notification Dropdown
   ======================================== */

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    max-height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #e1e8ed;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    overflow: hidden;
}

.notification-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notification-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f3f4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafbfc;
}

.notification-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.mark-all-read {
    background: none;
    border: none;
    color: var(--primary, #3b82f6);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.mark-all-read:hover {
    background-color: var(--primary-lighter, #dbeafe);
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-loading {
    padding: 40px 20px;
    text-align: center;
    color: #6c757d;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary, #3b82f6);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.notification-item {
    padding: 16px 20px;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.notification-item:hover {
    background-color: #f8fafc;
}

.notification-item.unread {
    background-color: var(--primary-lighter, #dbeafe);
    border-left: 3px solid var(--primary, #3b82f6);
}

.notification-icon {
    width: 32px;
    height: 32px;
    background: #e6f2ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
    margin-bottom: 4px;
    line-height: 1.3;
}

.notification-message {
    color: #6c757d;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 6px;
}

.notification-time {
    color: #adb5bd;
    font-size: 12px;
}

.notification-footer {
    padding: 12px 20px;
    border-top: 1px solid #f1f3f4;
    background: #fafbfc;
    text-align: center;
}

.view-all-link {
    color: var(--primary, #3b82f6);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.view-all-link:hover {
    text-decoration: underline;
}

.notification-empty {
    padding: 40px 20px;
    text-align: center;
    color: #6c757d;
}

.notification-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Mobile responsive for dropdown */
@media (max-width: 480px) {
    .notification-dropdown {
        width: 280px;
        right: -20px;
    }
}

/* ========================================
   Notification Preferences Panel
   ======================================== */

.notification-preferences-panel {
    max-width: 800px;
    margin: 0 auto;
    background: var(--notification-bg);
    border-radius: 12px;
    box-shadow: var(--notification-shadow);
    overflow: hidden;
}

.panel-header {
    padding: 24px;
    border-bottom: 1px solid var(--notification-border);
    background: linear-gradient(135deg, var(--notification-primary) 0%, #6366f1 100%);
    color: white;
}

.panel-header h3 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.panel-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9375rem;
}

/* Notification Types */
.notification-types {
    padding: 24px;
}

.notification-type-card {
    border: 1px solid var(--notification-border);
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.notification-type-card:hover {
    box-shadow: var(--notification-shadow);
}

.type-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--notification-bg);
}

.type-info h5 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--notification-text);
}

.type-info p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--notification-text-muted);
    line-height: 1.4;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--notification-primary);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* Delivery Options */
.delivery-options {
    padding: 16px 20px;
    background: var(--notification-bg-hover);
    border-top: 1px solid var(--notification-border);
}

.delivery-methods {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.delivery-methods label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border: 1px solid var(--notification-border);
    border-radius: 6px;
    background: var(--notification-bg);
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.delivery-methods label:hover {
    background: var(--notification-bg-hover);
}

.delivery-methods input:checked + .delivery-icon {
    color: var(--notification-primary);
}

.delivery-icon {
    font-size: 1rem;
}

.frequency-settings {
    display: flex;
    align-items: center;
    gap: 8px;
}

.frequency-settings label {
    font-size: 0.875rem;
    color: var(--notification-text);
    font-weight: 500;
}

.frequency-settings select {
    padding: 6px 8px;
    border: 1px solid var(--notification-border);
    border-radius: 4px;
    background: var(--notification-bg);
    font-size: 0.875rem;
    color: var(--notification-text);
}

/* Advanced Settings */
.advanced-settings {
    padding: 24px;
    border-top: 1px solid var(--notification-border);
    background: var(--notification-bg-hover);
}

.advanced-settings h4 {
    margin: 0 0 16px 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--notification-text);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--notification-text);
}

.setting-group input,
.setting-group select {
    padding: 8px 12px;
    border: 1px solid var(--notification-border);
    border-radius: 6px;
    background: var(--notification-bg);
    font-size: 0.875rem;
    color: var(--notification-text);
}

/* Panel Actions */
.panel-actions {
    padding: 20px 24px;
    border-top: 1px solid var(--notification-border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: var(--notification-bg);
}

.btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--notification-primary);
    color: white;
    border: 1px solid var(--notification-primary);
}

.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-outline {
    background: transparent;
    color: var(--notification-text);
    border: 1px solid var(--notification-border);
}

.btn-outline:hover {
    background: var(--notification-bg-hover);
}

/* ========================================
   Toast Notifications
   ======================================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--notification-bg);
    border: 1px solid var(--notification-border);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--notification-shadow), 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    max-width: 400px;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success {
    border-left: 4px solid var(--notification-success);
}

.toast.error {
    border-left: 4px solid var(--notification-error);
}

.toast.warning {
    border-left: 4px solid var(--notification-warning);
}

.toast.info {
    border-left: 4px solid var(--notification-info);
}

.toast-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    background: var(--notification-success);
}

.toast.error .toast-icon {
    background: var(--notification-error);
}

.toast.warning .toast-icon {
    background: var(--notification-warning);
}

.toast.info .toast-icon {
    background: var(--notification-info);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    color: var(--notification-text);
    margin-bottom: 4px;
    font-size: 0.875rem;
}

.toast-message {
    color: var(--notification-text-muted);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--notification-text-light);
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--notification-text);
}

/* ========================================
   Subscription Management
   ======================================== */

.subscription-card {
    border: 1px solid var(--notification-border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    background: var(--notification-bg);
    transition: all 0.2s ease;
}

.subscription-card:hover {
    box-shadow: var(--notification-shadow);
}

.subscription-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.subscription-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--notification-text);
    margin: 0;
}

.subscription-target {
    font-size: 0.875rem;
    color: var(--notification-text-muted);
    margin: 4px 0 0 0;
}

.subscription-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
}

.subscription-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.detail-group h6 {
    margin: 0 0 8px 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--notification-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.detail-tag {
    background: var(--notification-bg-hover);
    color: var(--notification-text-muted);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    border: 1px solid var(--notification-border);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .notification-center {
        position: fixed;
        top: 0;
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .notification-preferences-panel {
        margin: 0;
        border-radius: 0;
    }

    .delivery-methods {
        flex-direction: column;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .panel-actions {
        flex-direction: column;
    }

    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }

    .toast {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .notification-filters {
        padding: 12px 16px;
    }

    .notification-item {
        padding: 12px 16px;
    }

    .notification-header {
        padding: 16px;
    }

    .panel-header {
        padding: 20px 16px;
    }

    .notification-types,
    .advanced-settings {
        padding: 20px 16px;
    }

    .panel-actions {
        padding: 16px;
    }
}

/* ========================================
   Loading States
   ======================================== */

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--notification-border);
    border-top: 2px solid var(--notification-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.skeleton-loader {
    background: linear-gradient(90deg, var(--notification-bg-hover) 25%, rgba(255,255,255,0.5) 50%, var(--notification-bg-hover) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 14px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-text.title {
    height: 16px;
    width: 60%;
}

.skeleton-text.content {
    width: 100%;
}

.skeleton-text.short {
    width: 40%;
}