/* Modern Watchlists UI/UX - 2025 Design System */
/* Mobile-First, Glassmorphism, Bento Box Layouts */

:root {
    --watchlist-primary: #60a5fa;
    --watchlist-secondary: #3f37c9;
    --watchlist-accent: #4cc9f0;
    --watchlist-success: #10b981;
    --watchlist-danger: #ef476f;
    --watchlist-warning: #f59e0b;
    
    --watchlist-bg-glass: rgba(255, 255, 255, 0.8);
    --watchlist-bg-glass-dark: rgba(30, 41, 59, 0.8);
    --watchlist-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --watchlist-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
    --watchlist-shadow-hover: 0 12px 40px rgba(96, 165, 250, 0.2);
}

[data-theme="dark"] {
    --watchlist-bg-glass: rgba(30, 41, 59, 0.8);
    --watchlist-bg-glass-dark: rgba(15, 23, 42, 0.9);
}

/* App Header - Mobile Optimized */
.watchlist-app-header {
    position: static;
    top: auto;
    z-index: 50;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

/* Make header sticky on mobile ONLY on detail page - pushes navbar out of view when scrolling */
/* Only apply sticky to detail page header (has back button) */
@media (max-width: 767px) {
    /* Detail page: header with back button should be sticky */
    body:has(#watchlist-content) .watchlist-app-header,
    /* Alternative selector for detail page */
    .watchlist-app-header:has(.header-back) {
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg-glass);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }
    
    /* List page: header should NOT be sticky */
    .watchlist-app-header:not(:has(.header-back)) {
        position: static;
    }
}

.header-title-section {
    flex: 1;
    min-width: 0;
}

.watchlist-header-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.watchlist-header-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 4px 0 0 0;
}

.header-action-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.header-action-btn:hover {
    background: var(--bg-glass);
    transform: scale(1.05);
}

.header-action-btn i {
    font-size: 18px;
}

.header-back {
    flex-shrink: 0;
}

.back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.back-button:hover {
    background: var(--bg-glass);
    transform: scale(1.05);
}

.back-button i {
    font-size: 18px;
}

/* Hero Section */
.watchlist-hero {
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.1) 0%, rgba(63, 55, 201, 0.1) 100%);
    border-radius: var(--radius-xl);
    margin: 24px 20px;
}

.watchlist-hero-title {
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 800;
    margin-bottom: 12px;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.watchlist-hero-description {
    font-size: clamp(14px, 2vw, 18px);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 24px;
}

/* Bento Grid Layout */
.watchlist-bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 20px;
}

@media (min-width: 768px) {
    .watchlist-bento-grid {
        grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
        gap: 24px;
        padding: 24px;
    }
}

@media (min-width: 1200px) {
    .watchlist-bento-grid {
        grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    }
}

/* Watchlist Card - Modern Glassmorphism */
.watchlist-card-modern {
    background: var(--watchlist-bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--watchlist-shadow);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    min-height: 280px;
}

.watchlist-card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition);
}

.watchlist-card-modern:hover {
    transform: translateY(-4px);
    box-shadow: var(--watchlist-shadow-hover);
    border-color: var(--watchlist-primary);
}

.watchlist-card-modern:hover::before {
    opacity: 1;
}

.watchlist-card-header-modern {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.watchlist-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

.watchlist-card-title-section {
    flex: 1;
    min-width: 0;
}

.watchlist-card-title-modern {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.watchlist-card-meta-modern {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-secondary);
}

.watchlist-badge-modern {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.watchlist-card-description-modern {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Symbol Preview Grid */
.watchlist-symbols-preview-modern {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
    flex: 1;
}

.symbol-card-modern {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    cursor: pointer;
}

.symbol-card-modern:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
    border-color: var(--watchlist-primary);
}

.symbol-info-modern {
    flex: 1;
    min-width: 0;
}

.symbol-name-modern {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.symbol-company-modern {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.symbol-price-modern {
    text-align: right;
}

.symbol-price-value-modern {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.symbol-change-modern {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.symbol-change-modern.price-up {
    color: var(--watchlist-success);
}

.symbol-change-modern.price-down {
    color: var(--watchlist-danger);
}

/* Empty States */
.watchlist-empty-modern {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-symbols-message {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.empty-symbols-message p {
    margin: 0;
    opacity: 0.7;
}

.watchlist-empty-icon {
    font-size: 64px;
    color: var(--text-light);
    margin-bottom: 16px;
    opacity: 0.5;
}

.watchlist-empty-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.watchlist-empty-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Action Buttons */
.watchlist-actions-modern {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.btn-watchlist-modern {
    flex: 1;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

a.btn-watchlist-modern {
    text-decoration: none;
    color: inherit;
}

.btn-watchlist-primary-modern {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.3);
}

.btn-watchlist-primary-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.4);
}

.btn-watchlist-secondary-modern {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-watchlist-secondary-modern:hover {
    background: var(--bg-glass);
    border-color: var(--watchlist-primary);
}

/* Floating Action Button */
.fab-create-watchlist {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    box-shadow: 0 8px 24px rgba(96, 165, 250, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 100;
    transition: var(--transition);
}

.fab-create-watchlist:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(96, 165, 250, 0.5);
}

@media (min-width: 768px) {
    .fab-create-watchlist {
        bottom: 32px;
        right: 32px;
    }
}

/* Section Headers */
.watchlist-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 0;
    margin-bottom: 16px;
}

.watchlist-section-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.watchlist-section-title i {
    color: var(--watchlist-primary);
}

/* Loading States */
.watchlist-loading-modern {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    min-height: 400px;
}

.watchlist-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--watchlist-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.watchlist-loading-text {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Detail Page Styles */
.watchlist-detail-hero {
    background: var(--watchlist-bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    margin: 20px;
    box-shadow: var(--watchlist-shadow);
}

/* Hero section remains non-sticky - only the header bar above it is sticky */
@media (max-width: 767px) {
    .watchlist-detail-hero {
        /* Keep normal flow - not sticky */
        margin: 20px;
    }
}

.watchlist-detail-title-section {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.watchlist-detail-title-modern {
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 800;
    margin: 0 0 8px 0;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.watchlist-detail-meta-modern {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.watchlist-detail-description-modern {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 24px;
}

.watchlist-detail-actions-modern {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Symbol Grid in Detail */
.watchlist-symbols-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 20px;
}

@media (min-width: 768px) {
    .watchlist-symbols-grid-modern {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 20px;
    }
}

.symbol-card-detail-modern {
    background: var(--watchlist-bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.symbol-card-detail-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: var(--transition);
}

.symbol-card-detail-modern:hover {
    transform: translateY(-4px);
    box-shadow: var(--watchlist-shadow-hover);
    border-color: var(--watchlist-primary);
}

.symbol-card-detail-modern:hover::before {
    opacity: 1;
}

/* Pattern Information Styles */
.pattern-info {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.pattern-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.pattern-header i {
    color: var(--watchlist-primary);
}

.pattern-status {
    margin-left: auto;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.pattern-status.active {
    background: var(--watchlist-success);
    color: white;
}

.pattern-status.completed {
    background: var(--watchlist-primary);
    color: white;
}

.pattern-status.failed {
    background: var(--watchlist-danger);
    color: white;
}

.pattern-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.pattern-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pattern-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.pattern-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

/* Badge Styles */
.signal-badge-modern {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.signal-badge-modern.buy {
    background: var(--watchlist-success);
    color: white;
}

.signal-badge-modern.sell {
    background: var(--watchlist-danger);
    color: white;
}

.signal-badge-modern.hold {
    background: var(--watchlist-warning);
    color: white;
}

.signal-badge-modern.neutral {
    background: var(--text-light);
    color: white;
}

.stage-badge-modern {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Responsive Utilities */
@media (max-width: 767px) {
    .watchlist-bento-grid {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 16px;
    }
    
    .watchlist-card-modern {
        padding: 20px;
        min-height: 240px;
    }
    
    .watchlist-symbols-grid-modern {
        grid-template-columns: 1fr;
        padding: 16px;
    }
    
    .watchlist-detail-actions-modern {
        flex-direction: column;
    }
    
    .watchlist-detail-actions-modern .btn-watchlist-modern {
        width: 100%;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

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

.modal {
    background: var(--watchlist-bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--watchlist-shadow-lg);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 24px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-title i {
    color: var(--watchlist-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.form-row {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--watchlist-primary);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.form-input::placeholder {
    color: var(--text-light);
}

.btn {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(96, 165, 250, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-glass);
    border-color: var(--watchlist-primary);
}

.btn-danger {
    background: var(--watchlist-danger);
    color: white;
}

.btn-danger:hover {
    background: #dc3545;
    transform: translateY(-2px);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.watchlist-card-modern {
    animation: fadeInUp 0.4s ease-out;
}

.watchlist-card-modern:nth-child(1) { animation-delay: 0.1s; }
.watchlist-card-modern:nth-child(2) { animation-delay: 0.2s; }
.watchlist-card-modern:nth-child(3) { animation-delay: 0.3s; }
.watchlist-card-modern:nth-child(4) { animation-delay: 0.4s; }
.watchlist-card-modern:nth-child(5) { animation-delay: 0.5s; }
.watchlist-card-modern:nth-child(6) { animation-delay: 0.6s; }

