/**
 * Portfolio CSS - DivvyDiary Style (Sans variables CSS pour compatibilité)
 * Clean, modern, financial dashboard
 */

/* ============================================
   RESET & BASE
============================================ */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #F8F9FA;
    color: #1F2937;
    line-height: 1.6;
    font-size: 14px;
    margin: 0;
    padding: 0;
}

/* ============================================
   LAYOUT CONTAINERS
============================================ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section {
    margin-bottom: 2rem;
}

/* ============================================
   NAVIGATION
============================================ */
nav {
    background: #FFFFFF;
    border-bottom: 1px solid #E5E7EB;
    padding: 1rem 0;
    margin-bottom: 2rem;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav a {
    color: #1F2937;
    text-decoration: none;
    font-weight: 500;
}

nav a:hover {
    color: #3B82F6;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 600;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

nav a.nav-active {
    color: #3B82F6;
}

/* ============================================
   SECTION HEADERS
============================================ */
.section-header {
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 0.25rem;
}

.section-subtitle {
    font-size: 0.875rem;
    color: #9CA3AF;
}

/* ============================================
   KPI CARDS
============================================ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #10B981, #3B82F6);
}

.kpi-card.kpi-capital::before {
    background: linear-gradient(90deg, #6366F1, #8B5CF6);
}

.kpi-card.kpi-valeur::before {
    background: linear-gradient(90deg, #10B981, #059669);
}

.kpi-card.kpi-pv-positive::before {
    background: linear-gradient(90deg, #10B981, #34D399);
}

.kpi-card.kpi-pv-negative::before {
    background: linear-gradient(90deg, #EF4444, #F87171);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.kpi-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.kpi-icon.capital {
    background: linear-gradient(135deg, #EEF2FF, #E0E7FF);
}

.kpi-icon.valeur {
    background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
}

.kpi-icon.pv {
    background: linear-gradient(135deg, #F0FDF4, #DCFCE7);
}

.kpi-icon.pv-negative {
    background: linear-gradient(135deg, #FEF2F2, #FEE2E2);
}

.kpi-label {
    font-size: 0.8rem;
    color: #6B7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-value {
    font-size: 2.25rem;
    font-weight: 800;
    color: #1F2937;
    margin-bottom: 0.5rem;
    line-height: 1.1;
}

.kpi-value.positive {
    color: #059669;
}

.kpi-value.negative {
    color: #DC2626;
}

.kpi-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.kpi-change.positive {
    color: #059669;
    background: #ECFDF5;
}

.kpi-change.negative {
    color: #DC2626;
    background: #FEF2F2;
}

.kpi-meta {
    font-size: 0.8rem;
    color: #6B7280;
    margin-top: 0.75rem;
    font-weight: 500;
}

/* ============================================
   TABLES
============================================ */
.table-container {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.table-header {
    padding: 1.5rem;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1F2937;
}

.table-badge {
    background: #F8F9FA;
    color: #6B7280;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead {
    background: #F8F9FA;
    border-bottom: 1px solid #E5E7EB;
}

th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #6B7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

th:hover {
    background: #E5E7EB;
}

th.sortable {
    position: relative;
    padding-right: 1.5rem;
}

th.sortable::after {
    content: "⇅";
    position: absolute;
    right: 0.5rem;
    opacity: 0.3;
    font-size: 0.875rem;
}

th.sort-asc::after {
    content: "↑";
    opacity: 1;
    color: #3B82F6;
}

th.sort-desc::after {
    content: "↓";
    opacity: 1;
    color: #3B82F6;
}

tbody tr {
    border-bottom: 1px solid #E5E7EB;
    transition: background-color 0.15s;
}

tbody tr.position-row {
    cursor: pointer;
}

tbody tr.position-row:hover {
    background: #F9FAFB;
}

tbody tr.position-row.expanded {
    background: #EFF6FF;
}

tbody tr:last-child {
    border-bottom: none;
}

/* Position Details Row - Masquée par défaut, visible uniquement si expanded */
tbody tr.position-details {
    display: none;
}

tbody tr.position-details.expanded {
    display: table-row;
    background: #F9FAFB;
    border-top: none !important;
    animation: fadeIn 0.3s ease-out;
}

tbody tr.position-details.expanded td {
    padding: 1.5rem !important;
}

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

.position-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 0;
}

.btn-action {
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-width: 200px;
    position: relative;
    overflow: hidden;
}

.btn-action::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-action:hover::before {
    left: 100%;
}

.btn-edit-url {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
}

.btn-edit-url:hover {
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4), 0 4px 6px -2px rgba(59, 130, 246, 0.3);
}

.btn-edit-url:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-rename {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    color: white;
}

.btn-rename:hover {
    background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(139, 92, 246, 0.4), 0 4px 6px -2px rgba(139, 92, 246, 0.3);
}

.btn-rename:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(139, 92, 246, 0.3);
}

.btn-sell {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
}

.btn-sell:hover {
    background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(245, 158, 11, 0.4), 0 4px 6px -2px rgba(245, 158, 11, 0.3);
}

.btn-sell:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.3);
}

.btn-action .btn-icon {
    font-size: 1.25rem;
    line-height: 1;
}

/* Stock Logo Link */
.stock-logo-link {
    display: inline-block;
    transition: transform 0.2s;
}

.stock-logo-link:hover {
    transform: scale(1.1);
}

.stock-logo-link .stock-logo {
    cursor: pointer;
}

td {
    padding: 1rem;
}

/* Stock Logo Cell */
.stock-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stock-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: contain;
    background: #F8F9FA;
    padding: 0.25rem;
    flex-shrink: 0;
}

.stock-info {
    display: flex;
    flex-direction: column;
}

.stock-name {
    font-weight: 500;
    color: #1F2937;
    margin-bottom: 0.125rem;
}

.stock-ticker {
    font-size: 0.75rem;
    color: #9CA3AF;
    font-family: "SF Mono", Monaco, Consolas, monospace;
}

/* Number formatting */
.number {
    font-family: "SF Mono", Monaco, Consolas, monospace;
    font-size: 0.875rem;
}

.positive {
    color: #10B981;
    font-weight: 500;
}

.negative {
    color: #EF4444;
    font-weight: 500;
}

.neutral {
    color: #6B7280;
}

/* ============================================
   CHARTS
============================================ */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-container {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #E5E7EB;
}

.chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1F2937;
    margin: 0;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.chart-btn {
    padding: 0.375rem 0.625rem;
    border: 1px solid #D1D5DB;
    background: #FFFFFF;
    color: #6B7280;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 42px;
}

.chart-btn:hover {
    border-color: #3B82F6;
    color: #3B82F6;
}

.chart-btn.active {
    background: #3B82F6;
    border-color: #3B82F6;
    color: white;
}

/* Frequency controls (Jour/Semaine) */
.freq-controls {
    position: absolute;
    bottom: 30px;
    right: 10px;
    display: flex;
    gap: 0.375rem;
    z-index: 10;
}

.freq-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid #D1D5DB;
    background: rgba(255, 255, 255, 0.95);
    color: #6B7280;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}

.freq-btn:hover {
    border-color: #10B981;
    color: #10B981;
}

.freq-btn.active {
    background: #10B981;
    border-color: #10B981;
    color: white;
}

/* ============================================
   SEARCH TICKER TOGGLE
============================================ */
.search-toggle-container {
    margin: 2rem 0 1rem;
}

.transaction-toggle-container {
    margin: 2rem 0 1rem;
}

.toggle-btn {
    width: 100%;
    padding: 1.125rem 1.5rem;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3), 0 2px 4px -1px rgba(59, 130, 246, 0.2);
    position: relative;
    overflow: hidden;
}

.toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4), 0 4px 6px -2px rgba(59, 130, 246, 0.3);
}

.toggle-btn:hover::before {
    opacity: 1;
}

.toggle-btn:active {
    transform: translateY(0);
}

.toggle-btn.active {
    background: linear-gradient(135deg, #1E40AF 0%, #1E3A8A 100%);
}

.btn-icon {
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
}

.btn-text {
    flex: 1;
}

.toggle-icon {
    font-size: 1.5rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #FFFFFF;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
}

.toggle-btn.active .toggle-icon {
    transform: rotate(90deg);
}

.search-section {
    margin-bottom: 2rem;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.search-content {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.search-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.2s;
}

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

.search-btn {
    padding: 0.75rem 1.5rem;
    background: #3B82F6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.search-btn:hover {
    background: #2563EB;
}

.search-results {
    margin-top: 1.5rem;
}

.search-results-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #6B7280;
    margin-bottom: 1rem;
}

.search-message {
    display: none;
    animation: slideDown 0.3s ease-out;
}

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

.loader {
    border: 3px solid #F3F4F6;
    border-top: 3px solid #3B82F6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

.btn-add-ticker {
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.btn-add-ticker::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn-add-ticker:hover::before {
    left: 100%;
}

.btn-add-ticker:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.4);
}

.btn-add-ticker:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

/* Responsive search */
@media (max-width: 640px) {
    .search-input-group {
        flex-direction: column;
    }

    .search-btn {
        width: 100%;
    }
}

/* ============================================
   TRANSACTION FORM
============================================ */
.transaction-content {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.transaction-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.form-label .optional {
    font-weight: 400;
    color: #6B7280;
    font-size: 0.8125rem;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.2s;
    background: #FFFFFF;
    color: #1F2937;
}

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

.form-input::placeholder {
    color: #9CA3AF;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid #E5E7EB;
}

.btn-submit-transaction {
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3), 0 2px 4px -1px rgba(16, 185, 129, 0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-submit-transaction:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4), 0 4px 6px -2px rgba(16, 185, 129, 0.3);
}

.btn-submit-transaction:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

.alert-info {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.alert-info h6 {
    color: #1E40AF;
    margin: 0 0 0.75rem 0;
    font-size: 1.125rem;
}

.alert-info p {
    color: #1E3A8A;
    margin: 0 0 1rem 0;
    line-height: 1.6;
}

.btn-create-portfolio {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-create-portfolio:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}

/* Responsive transaction form */
@media (max-width: 768px) {
    .transaction-form-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        justify-content: stretch;
    }

    .btn-submit-transaction {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   NOTIFICATIONS
============================================ */
.notification {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    animation: slideInDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification.fade-out {
    animation: slideOutUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translate(-50%, -30px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes slideOutUp {
    from {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -30px);
    }
}

/* Responsive notification */
@media (max-width: 640px) {
    .notification {
        left: 1rem;
        right: 1rem;
        min-width: auto;
        transform: none;
    }

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

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

    .notification.fade-out {
        animation: slideOutUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }
}

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

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

.notification-warning {
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
    border-left: 4px solid #E8601C;
}

.notification-icon {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.25rem;
    font-weight: bold;
}

.notification-success .notification-icon {
    background: #10B981;
    color: white;
}

.notification-error .notification-icon {
    background: #EF4444;
    color: white;
}

.notification-warning .notification-icon {
    background: #E8601C;
    color: white;
}

.notification-content {
    flex: 1;
}

.notification-content strong {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.notification-success .notification-content strong {
    color: #065F46;
}

.notification-error .notification-content strong {
    color: #991B1B;
}

.notification-warning .notification-content strong {
    color: #92400E;
}

.notification-content p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.notification-success .notification-content p {
    color: #047857;
}

.notification-error .notification-content p {
    color: #B91C1C;
}

.notification-warning .notification-content p {
    color: #B45309;
}

.notification-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #6B7280;
    cursor: pointer;
    padding: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.notification-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1F2937;
}

/* ============================================
   ALERTS
============================================ */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert-info {
    background: #DBEAFE;
    border-color: #3B82F6;
    color: #1E40AF;
}

.alert-warning {
    background: #FEF3C7;
    border-color: #F59E0B;
    color: #92400E;
}

.alert-success {
    background: #D1FAE5;
    border-color: #10B981;
    color: #065F46;
}

.alert-error {
    background: #FEE2E2;
    border-color: #EF4444;
    color: #991B1B;
}

/* ============================================
   TRANSACTION HISTORY
============================================ */
.operation-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.badge-achat {
    background: #D1FAE5;
    color: #065F46;
}

.badge-vente {
    background: #FEE2E2;
    color: #991B1B;
}

.portfolio-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    background: #F3F4F6;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
}

.btn-delete-transaction {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
    color: #6B7280;
}

.btn-delete-transaction:hover {
    background: #FEE2E2;
    color: #EF4444;
    transform: scale(1.1);
}

/* ============================================
   MODAL
============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease-out;
}

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

.modal-container {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideUp 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #E5E7EB;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1F2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    color: #6B7280;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #F3F4F6;
    color: #1F2937;
}

.modal-body {
    padding: 1.5rem;
}

.modal-description {
    margin: 0 0 1rem 0;
    color: #4B5563;
    line-height: 1.6;
}

.transaction-details {
    margin-top: 1rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.5rem;
    border-top: 1px solid #E5E7EB;
}

.btn-cancel {
    padding: 0.75rem 1.5rem;
    background: #F3F4F6;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #E5E7EB;
}

.btn-delete {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

.btn-delete:hover {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.4);
}

.btn-delete:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

/* ============================================
   UTILITIES
============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: #9CA3AF; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .kpi-value {
        font-size: 1.75rem;
    }

    .kpi-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .table-container {
        overflow-x: auto;
    }

    table {
        font-size: 0.75rem;
    }

    th, td {
        padding: 0.5rem;
    }

    .stock-logo {
        width: 32px;
        height: 32px;
    }
}

/* ============================================
   PORTFOLIO TABS
============================================ */
.portfolio-tabs-wrapper {
    margin-bottom: 2rem;
}

.portfolio-tabs {
    display: flex;
    background: transparent;
    border-bottom: none;
    margin-bottom: 0;
    overflow-x: auto;
    position: relative;
    z-index: 1;
}

.portfolio-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: 1px solid transparent;
    border-bottom: none;
    background: #F3F4F6;
    color: #6B7280;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: all 0.2s ease;
    border-radius: 8px 8px 0 0;
    margin-right: 4px;
}

.portfolio-tab:hover {
    color: #10B981;
    background: #E5E7EB;
}

.portfolio-tab.active {
    color: #10B981;
    background: #FFFFFF;
    border-color: #E5E7EB;
    margin-bottom: -1px;
    padding-bottom: calc(0.875rem + 1px);
}

.portfolio-tab.active::after {
    display: none;
}

.portfolio-tab-icon {
    font-size: 1.1rem;
}

.portfolio-tab-content {
    display: none;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 0 8px 8px 8px;
    padding: 1.5rem;
}

.portfolio-tab-content.active {
    display: block;
}

/* Ajuster les éléments internes du tab content */
.portfolio-tab-content .kpi-grid {
    margin-top: 0;
}

.portfolio-tab-content .charts-grid {
    margin-top: 1.5rem;
}

.portfolio-tab-content .table-container {
    border: none;
    box-shadow: none;
}

@media (max-width: 768px) {
    .portfolio-tabs {
        justify-content: flex-start;
    }

    .portfolio-tab {
        padding: 0.625rem 1rem;
        font-size: 0.8rem;
    }

    .portfolio-tab.active {
        padding-bottom: calc(0.625rem + 1px);
    }

    .portfolio-tab-content {
        padding: 1rem;
        border-radius: 0 0 8px 8px;
    }
}

/* ============================================
   NO PORTFOLIO MESSAGE
============================================ */
.no-portfolio-message {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

.no-portfolio-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.no-portfolio-message h4 {
    color: #065F46;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
}

.no-portfolio-message p {
    color: #047857;
    margin: 0 0 1.5rem 0;
    line-height: 1.6;
}

.no-portfolio-message small {
    color: #059669;
    font-size: 0.875rem;
}

.btn-create-portfolio {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #10B981;
    color: #FFFFFF;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-create-portfolio:hover {
    background: #059669;
    color: #FFFFFF;
}

.btn-create-portfolio span {
    font-size: 1.25rem;
}

/* ============================================
   ACCOUNT PAGE STYLES
============================================ */
.badge-rouge {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.badge-vert {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.badge-bleu {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.portfolio-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.portfolio-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

.portfolio-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1F2937;
}

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

.btn-small {
    padding: 0.5rem 1rem;
    border: 1px solid #D1D5DB;
    background: #FFFFFF;
    color: #374151;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    border-color: #3B82F6;
    color: #3B82F6;
    background: #EFF6FF;
}

.btn-small.btn-danger {
    border-color: #EF4444;
    color: #EF4444;
}

.btn-small.btn-danger:hover {
    background: #FEE2E2;
}

.btn-primary {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}

.btn-success {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4);
}

.portfolios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.section-divider {
    margin: 3rem 0;
    border: none;
    border-top: 2px solid #E5E7EB;
}

.password-requirements {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #1E40AF;
}

.password-requirements ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

.password-requirements li {
    margin: 0.25rem 0;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #FFFFFF;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #E5E7EB;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1F2937;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6B7280;
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #F3F4F6;
    color: #1F2937;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #E5E7EB;
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: #F3F4F6;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #E5E7EB;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 2.5rem;
}

.password-toggle-btn {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: #374151;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.password-toggle-btn:hover {
    color: #1F2937;
}

/* Animations for collapsible sections */
.collapsible-section {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding-top: 0;
    padding-bottom: 0;
}

.collapsible-section.expanded {
    max-height: 2000px;
    opacity: 1;
    padding: 1.5rem;
}

.toggle-chevron {
    font-size: 1.5rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
}

.toggle-chevron.rotated {
    transform: rotate(180deg);
}

/* Create portfolio tags */
.create-portfolio-tags {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.create-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.create-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.create-tag-pea {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    color: #065F46;
}

.create-tag-pea:hover {
    background: #D1FAE5;
    color: #065F46;
}

.create-tag-cto {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    color: #1E40AF;
}

.create-tag-cto:hover {
    background: #DBEAFE;
    color: #1E40AF;
}
