/**
 * Watchlist Management CSS
 * Phase 3: Research & Discovery Engine
 * WCAG 2.1 AA Compliant
 * Matches dashboard.php design system
 */

.watchlists-main {
    min-height: calc(100vh - 200px);
    padding: 2rem 1rem;
}

.watchlists-container {
    max-width: 1600px;
    margin: 0 auto;
}

/* Header */
.watchlists-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    gap: 1rem;
}

.watchlists-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary, #e2e8f0);
    font-weight: 700;
}

.watchlists-header .subtitle {
    color: var(--text-secondary, #94a3b8);
    font-size: 1rem;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Watchlists Grid */
.watchlists-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .watchlists-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .watchlists-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Watchlist Card */
.watchlist-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.watchlist-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.watchlist-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.watchlist-info h3 {
    font-size: 1.25rem;
    color: var(--text-primary, #e2e8f0);
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.watchlist-description {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.4;
}

.watchlist-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary, #94a3b8);
    font-size: 1rem;
    transition: all 0.2s;
    line-height: 1;
}

.btn-icon:hover {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.5);
    color: var(--text-primary, #e2e8f0);
}

/* Watchlist Stats */
.watchlist-stats {
    display: flex;
    gap: 2rem;
    padding: 1rem 0;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary, #94a3b8);
}

/* Watchlist Items */
.watchlist-items {
    min-height: 100px;
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.watchlist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(148, 163, 184, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.item-symbol {
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
    font-size: 0.95rem;
    flex: 1;
}

.rank-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.rank-badge.excellent {
    background: #10b981;
    color: white;
}

.rank-badge.good {
    background: #3b82f6;
    color: white;
}

.rank-badge.fair {
    background: #f59e0b;
    color: white;
}

.rank-badge.poor {
    background: #f59e0b;
    color: white;
}

.rank-badge.avoid {
    background: #ef4444;
    color: white;
}

.target-price {
    font-size: 0.8rem;
    color: var(--text-secondary, #94a3b8);
}

.btn-icon-small {
    background: transparent;
    border: none;
    color: var(--text-secondary, #94a3b8);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-icon-small:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.empty-items {
    text-align: center;
    color: var(--text-secondary, #94a3b8);
    padding: 2rem;
    font-style: italic;
}

.loading {
    text-align: center;
    color: var(--text-secondary, #94a3b8);
    padding: 2rem;
}

.error {
    text-align: center;
    color: #ef4444;
    padding: 1rem;
}

/* Watchlist Footer */
.watchlist-footer {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.btn-secondary {
    flex: 1;
    padding: 0.75rem 1rem;
    background: rgba(148, 163, 184, 0.1);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: var(--text-primary, #e2e8f0);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(148, 163, 184, 0.2);
    border-color: rgba(148, 163, 184, 0.5);
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: #3b82f6;
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: #2563eb;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    grid-column: 1 / -1;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h2 {
    color: var(--text-primary, #e2e8f0);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 2rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    margin: 0 auto;
}

.modal-large .modal-content {
    max-width: 500px; /* Match add-stock-modal size */
    width: 100%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary, #e2e8f0);
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary, #94a3b8);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary, #e2e8f0);
}

.modal-body {
    padding: 1.5rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary, #e2e8f0);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: var(--text-primary, #e2e8f0);
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

/* View Watchlist Modal - Match Add Stock Modal Style */
.watchlist-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    gap: 1rem;
}

.watchlist-detail-header p {
    color: var(--text-secondary, #94a3b8);
    margin: 0;
    flex: 1;
    font-size: 0.9rem;
}

.watchlist-items-full {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

.watchlist-item-full {
    padding: 1rem;
    background: rgba(148, 163, 184, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 8px;
    transition: background 0.2s;
}

.watchlist-item-full:hover {
    background: rgba(148, 163, 184, 0.1);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.item-header .item-symbol {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
}

.item-notes {
    color: var(--text-secondary, #94a3b8);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
    font-style: italic;
}

.item-prices {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary, #94a3b8);
}

.item-prices span {
    padding: 0.25rem 0.5rem;
    background: rgba(148, 163, 184, 0.1);
    border-radius: 4px;
}

.item-date {
    font-size: 0.85rem;
    color: var(--text-secondary, #94a3b8);
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .watchlists-header {
        flex-direction: column;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .watchlist-detail-header {
        flex-direction: column;
        gap: 1rem;
    }
}

