/* Styles spécifiques à la page watchlist - GEOPOL Analytics */
/* Version 2.1 - Correction complète des problèmes d'affichage */

/* ============================================================================
   ITEMS DE WATCHLIST AMELIORES
   ============================================================================ */

.watchlist-item {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 1rem;
    cursor: grab;
    position: relative;
    overflow: hidden;
}

.watchlist-item:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px) scale(1.01);
    border-color: #cbd5e1;
}

.watchlist-item:active {
    cursor: grabbing;
}

.watchlist-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.watchlist-item.drag-over {
    border: 2px dashed #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    animation: pulse 0.5s ease-in-out;
}

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

.watchlist-item .indicator-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0.5rem 0;
    line-height: 1.3;
}

.watchlist-item .indicator-value {
    font-size: 2rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.watchlist-item .indicator-change {
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    display: inline-block;
    margin-top: 0.25rem;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.watchlist-item .indicator-change.positive {
    background-color: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
    box-shadow: 0 1px 2px rgba(22, 101, 52, 0.1);
}

.watchlist-item .indicator-change.negative {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
    box-shadow: 0 1px 2px rgba(153, 27, 27, 0.1);
}

.watchlist-item .indicator-change.neutral {
    background-color: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}

.watchlist-item .last-update {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
    font-style: italic;
}

/* ============================================================================
   BADGES DE TYPE AMELIORES
   ============================================================================ */

.indicator-type-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.indicator-type-badge.index {
    background-color: #dbeafe;
    color: #1e40af;
    border-color: #bfdbfe;
}

.indicator-type-badge.etf {
    background-color: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.indicator-type-badge.stock {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

.indicator-type-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   BOUTONS D'ACTION AMELIORES
   ============================================================================ */

.btn-watchlist-chart,
.btn-watchlist-delete {
    padding: 0.625rem 0.875rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-watchlist-chart {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: 1px solid #1d4ed8;
}

.btn-watchlist-chart:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-watchlist-delete {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: 1px solid #b91c1c;
}

.btn-watchlist-delete:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ============================================================================
   FORMULAIRE AMELIORE
   ============================================================================ */

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-weight: 700;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    letter-spacing: 0.025em;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: #ffffff;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

.form-input:disabled,
.form-select:disabled {
    background-color: #f9fafb;
    border-color: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

button[type="submit"] {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.025em;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

button[type="submit"]:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

button[type="submit"]:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.025em;
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(107, 114, 128, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.025em;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

/* ============================================================================
   STATISTIQUES AMELIOREES
   ============================================================================ */

.stat-card {
    background: rgba(15,23,42,.5);
    border: 1px solid rgba(99,102,241,.2);
    border-radius: 5px;
    padding: 6px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: border-color 0.2s;
    white-space: nowrap;
}

.stat-card:hover {
    border-color: rgba(99,102,241,.45);
    transform: none;
    box-shadow: none;
}

.stat-value {
    font-family: var(--mono, monospace);
    font-size: 13px;
    font-weight: 700;
    color: var(--accent, #64f0c8);
    letter-spacing: 0.04em;
    margin-bottom: 0;
}

.stat-label {
    font-family: var(--mono, monospace);
    font-size: 8px;
    color: var(--dim, #64748b);
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ============================================================================
   LIMITES ET AVIS UTILISATEUR
   ============================================================================ */

.limits-info {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0369a1;
    box-shadow: 0 1px 2px rgba(3, 105, 161, 0.1);
}

.limits-info.text-orange-600 {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border-color: #fdba74;
    color: #c2410c;
}

.limits-info.text-red-600 {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #fca5a5;
    color: #b91c1c;
    animation: warning-pulse 2s infinite;
}

@keyframes warning-pulse {
    0% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(185, 28, 28, 0); }
    100% { box-shadow: 0 0 0 0 rgba(185, 28, 28, 0); }
}

/* ============================================================================
   ÉTATS (LOADING, ERROR, EMPTY) AMELIORES
   ============================================================================ */

.loading-state,
.error-state,
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.loading-spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    color: #dc2626;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    padding: 1.25rem;
    border-radius: 0.5rem;
    border-left: 4px solid #dc2626;
    box-shadow: 0 1px 3px rgba(220, 38, 38, 0.1);
}

.empty-state i {
    font-size: 4rem;
    color: #9ca3af;
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 1rem;
    color: #6b7280;
    line-height: 1.5;
}

/* ============================================================================
   NOTIFICATIONS AMELIOREES
   ============================================================================ */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    color: white;
    font-weight: 600;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 9999;
    animation: slideIn 0.3s ease-out;
    max-width: 350px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.notification.notification-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-left: 4px solid #047857;
}

.notification.notification-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-left: 4px solid #b91c1c;
}

.notification.notification-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-left: 4px solid #1d4ed8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ============================================================================
   GRAPHIQUE AMELIORE
   ============================================================================ */

#watchlist-chart {
    width: 100% !important;
    max-height: 400px;
    border-radius: 0.5rem;
    background: white;
}

.chart-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-top: 1.5rem;
    border: 1px solid #e5e7eb;
}

/* ============================================================================
   DRAG AND DROP AMELIORE
   ============================================================================ */

.watchlist-item[draggable="true"] {
    cursor: grab;
}

.watchlist-item.dragging {
    opacity: 0.6;
    transform: scale(0.98);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.watchlist-item.drag-over {
    border: 2px dashed #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    animation: dash-pulse 0.5s ease-in-out infinite;
}

@keyframes dash-pulse {
    0% { border-color: #3b82f6; }
    50% { border-color: #60a5fa; }
    100% { border-color: #3b82f6; }
}

/* ============================================================================
   RESPONSIVE AMELIORE
   ============================================================================ */

@media (max-width: 768px) {
    .watchlist-item {
        padding: 1.25rem;
    }

    .watchlist-item .indicator-name {
        font-size: 1.125rem;
    }

    .watchlist-item .indicator-value {
        font-size: 1.75rem;
    }

    .stat-value {
        font-size: 11px;
    }

    .btn-watchlist-chart,
    .btn-watchlist-delete {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }

    .stat-card {
        padding: 5px 10px;
    }
}

@media (max-width: 480px) {
    .watchlist-item {
        padding: 1rem;
    }

    .watchlist-item .indicator-value {
        font-size: 1.5rem;
    }

    .stat-card {
        padding: 4px 8px;
    }

    .stat-value {
        font-size: 11px;
    }

    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ============================================================================
   ANIMATIONS AMELIOREES
   ============================================================================ */

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

@keyframes popIn {
    0% { transform: scale(0.9); opacity: 0; }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

.watchlist-item {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ============================================================================
   PRINT AMELIORE
   ============================================================================ */

@media print {
    .btn-watchlist-chart,
    .btn-watchlist-delete,
    button,
    form,
    .notification {
        display: none !important;
    }

    .watchlist-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
        background: white !important;
    }

    .stat-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
        background: white !important;
    }
}

/* ============================================================================
   LIGNES COMPACTES — VUE WATCHLIST (v2.2)
   ============================================================================ */

/* Grille 3 colonnes pour les items watchlist */
#watchlist-items {
    flex: 1;
    overflow: auto;
    padding-right: 4px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    align-content: start;
}

.wl-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    cursor: grab;
    transition: border-color 0.15s, background 0.15s;
    min-height: 0;
    background: rgba(15,23,42,.4);
    border: 1px solid rgba(99,102,241,.15);
    border-radius: 5px;
}

.wl-row:hover {
    background: rgba(99,102,241,.08);
    border-color: rgba(99,102,241,.35);
}

.wl-row:active {
    cursor: grabbing;
}

/* Badge type compact */
.wl-type {
    font-size: 7px;
    font-weight: 800;
    padding: 2px 4px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
    min-width: 24px;
    text-align: center;
    line-height: 1;
}

.wl-index { background: rgba(59,130,246,.2); color: #60a5fa; }
.wl-etf   { background: rgba(245,158,11,.2); color: #fbbf24; }
.wl-stock { background: rgba(16,185,129,.2); color: #34d399; }

/* Prix */
.wl-price {
    font-size: 11px;
    font-weight: 700;
    color: var(--text, #e2e8f0);
    white-space: nowrap;
    flex-shrink: 0;
    font-family: var(--mono, monospace);
}

/* Variation */
.wl-change {
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 56px;
    text-align: right;
    font-family: var(--mono, monospace);
}

.wl-pos { color: #4ade80; }
.wl-neg { color: #f87171; }

/* Heure */
.wl-time {
    font-size: 9px;
    color: var(--dim, #64748b);
    flex-shrink: 0;
    font-family: var(--mono, monospace);
}

/* Boutons actions */
.wl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.wl-btn-chart {
    background: rgba(59,130,246,.15);
    color: #60a5fa;
}

.wl-btn-chart:hover {
    background: rgba(59,130,246,.4);
    color: white;
}

.wl-btn-del {
    background: rgba(248,113,113,.12);
    color: #f87171;
}

.wl-btn-del:hover {
    background: rgba(248,113,113,.4);
    color: white;
}

/* Responsive : 2 colonnes sur tablette, 1 sur mobile */
@media (max-width: 900px) {
    #watchlist-items { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
    #watchlist-items { grid-template-columns: 1fr; }
}
