/* ==============================================================================
   DIAMOND FLOW SYSTEM - MASTER STYLING & MINIMALIST ENHANCEMENTS (STABLE v5.0)
   Người thiết kế: A. VU Studio
   ============================================================================== */

/* --- 1. HIỆU ỨNG MODAL & DI SẢN --- */
#edit-log-modal {
    animation: modalFadeIn 0.25s ease-out !important;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#edit-log-modal .glass-card {
    background: rgba(17, 17, 17, 0.98) !important;
    border: 1px solid rgba(0, 212, 255, 0.15) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6) !important;
    border-radius: 12px !important;
    backdrop-filter: blur(10px) !important;
}

/* --- 2. GIAO DIỆN FORM TRONG MODAL --- */
#edit-log-modal .zen-field label {
    color: rgba(0, 212, 255, 0.9) !important;
    font-size: 0.7rem !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    margin-bottom: 6px !important;
    font-weight: 600;
    display: block;
}

#edit-log-modal input[type="text"],
#edit-log-modal input[type="number"],
#edit-log-modal select,
#edit-log-modal textarea {
    background: #111111 !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    border-radius: 6px !important;
    padding: 12px !important;
    transition: all 0.2s ease;
}

#edit-log-modal input:focus,
#edit-log-modal select:focus,
#edit-log-modal textarea:focus {
    border-color: #00d4ff !important;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.15) !important;
    outline: none;
}

/* --- 3. ĐỊNH DẠNG NÚT BẤM DI SẢN TRONG FORM CHỈNH SỬA --- */
.modal-action-btn {
    padding: 12px 24px !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    letter-spacing: 1px !important;
    text-transform: uppercase !important;
    border-radius: 4px !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
}

.btn-save-heritage {
    background: linear-gradient(90deg, rgba(0, 212, 255, 0.1), rgba(0, 212, 255, 0.2)) !important;
    border: 1px solid #00d4ff !important;
    color: #00d4ff !important;
}

.btn-save-heritage:hover {
    background: #00d4ff !important;
    color: #000000 !important;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.4) !important;
}

.btn-cancel-heritage {
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: rgba(255, 255, 255, 0.6) !important;
}

.btn-cancel-heritage:hover {
    border-color: rgba(255, 255, 255, 0.4) !important;
    color: #ffffff !important;
}

/* --- 4. CARD THỐNG KÊ NÂNG CAO (METRICS GRID) --- */
.pnl-positive {
    color: #27c93f !important; 
    text-shadow: 0 0 10px rgba(39, 201, 63, 0.2);
}

.pnl-negative {
    color: #ff4d4d !important; 
    text-shadow: 0 0 10px rgba(255, 77, 77, 0.2);
}

/* --- 5. TỐI ƯU KHUNG CHỨA CANVAS ĐỒ THỊ --- */
.canvas-safe-wrapper {
    position: relative !important;
    width: 100% !important;
    height: 100% !important; 
    margin: 0 auto !important;
    box-sizing: border-box;
}

/* --- 6. KHUNG CHỨA BIỂU ĐỒ (CHART BOX OVERRIDE) --- */
.chart-box {
    background: linear-gradient(180deg, rgba(25,25,25,0.6) 0%, rgba(5,5,5,0.8) 100%) !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
    box-shadow: inset 0 2px 10px rgba(255,255,255,0.02), 0 15px 35px rgba(0,0,0,0.6) !important;
    border-radius: 10px !important;
    padding: 20px !important;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

/* 💎 SỬA TRỌNG TÂM: Đè nát max-height cũ của style.css để giải phóng chiều cao, hiện trọn vẹn lịch 100% */
.dashboard-charts .chart-box {
    height: auto !important; 
    max-height: none !important;
    overflow: visible !important;
}

/* --- 7. HỆ THỐNG LỊCH TRỰC QUAN 7 CỘT --- */
#trading-calendar {
    padding: 10px 5px;
    width: 100%;
}

.calendar-master-grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 6px !important;
    width: 100% !important;
    box-sizing: border-box;
}

.calendar-week-header {
    text-align: center !important;
    font-size: 0.7rem !important;
    opacity: 0.3 !important;
    font-weight: 700 !important;
    padding-bottom: 2px !important;
    text-transform: uppercase;
}

.calendar-premium-cell {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.04) !important;
    border-radius: 6px !important;
    aspect-ratio: 1.1 / 1 !important;
    padding: 6px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    box-sizing: border-box;
}

.calendar-premium-cell:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-1px);
}

.calendar-premium-cell .cal-num {
    font-size: 0.75rem !important;
    opacity: 0.4;
    font-weight: 600;
}

.calendar-premium-cell .cal-pnl-val {
    font-size: 0.7rem !important;
    font-weight: 600;
    text-align: right;
    width: 100%;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-premium-cell.premium-win {
    background: rgba(39, 201, 63, 0.04) !important;
    border-color: rgba(39, 201, 63, 0.15) !important;
}
.calendar-premium-cell.premium-win .cal-pnl-val {
    color: #27c93f !important;
}

.calendar-premium-cell.premium-loss {
    background: rgba(255, 77, 77, 0.04) !important;
    border-color: rgba(255, 77, 77, 0.15) !important;
}
.calendar-premium-cell.premium-loss .cal-pnl-val {
    color: #ff4d4d !important;
}

.calendar-premium-cell.premium-empty .cal-pnl-val {
    opacity: 0.15 !important;
}

/* --- 8. MẬT ĐỘ KỶ LUẬT (DISCIPLINE HEATMAP) --- */
/* 💎 SỬA TRỌNG TÂM: Zoom to toàn bộ ô vuông lấp đầy diện tích khung cha, tạo sự cân xứng tuyệt đối */
.heat-cell {
    width: 100% !important;
    height: 100% !important;
    border-radius: 6px !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-sizing: border-box;
    aspect-ratio: auto !important; /* Phá vỡ tỉ lệ cũ để tự nở khít lưới inline grid */
}

.heat-empty {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px dashed rgba(255, 255, 255, 0.06) !important;
}

.heat-cell.heat-disciplined {
    background: rgba(0, 212, 255, 0.04) !important;
    border: 1px solid rgba(0, 212, 255, 0.3) !important;
    box-shadow: inset 0 0 6px rgba(0, 212, 255, 0.05);
}

.heat-cell.heat-disciplined:hover {
    background: rgba(0, 212, 255, 0.25) !important;
    border: 1px solid #00d4ff !important;
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.4) !important;
    transform: translateY(-2px) scale(1.05);
}

.heat-cell.heat-violated {
    background: rgba(255, 77, 77, 0.15) !important;
    border: 1px solid #ff4d4d !important;
}

.heat-cell.heat-violated:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 0 12px rgba(255, 77, 77, 0.3) !important;
}

/* --- 9. DROPDOWN MENU CHỐNG LỖI HIỂN THỊ CHỮ --- */
select.tag-input {
    background-color: #111111 !important;
    color: #00d4ff !important;
    border: 1px solid rgba(0, 212, 255, 0.2) !important;
    padding: 10px !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    outline: none !important;
    font-family: 'Inter', sans-serif !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%2300d4ff'><polygon points='0,2 10,2 5,8'/></svg>") !important;
    background-repeat: no-repeat !important;
    background-position: right 15px center !important;
    padding-right: 35px !important;
}

select.tag-input option {
    background-color: #111111 !important;
    color: #ffffff !important;
}

.opacity-2 { opacity: 0.2; }
/* --- 12. THIẾT KẾ THANH CUỘN (SCROLLBAR) NGHỆ THUẬT CHO KHUNG SỬA DI SẢN --- */
/* Tối ưu hóa thanh cuộn trên các trình duyệt lõi Chromium (Chrome, Edge, Brave...) */
.modal-scroll-clean::-webkit-scrollbar {
    width: 6px !important; /* Độ mảnh tinh tế của thanh cuộn dọc */
    height: 6px !important;
}

/* Định dạng phân vùng rãnh chạy của thanh cuộn */
.modal-scroll-clean::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.4) !important; /* Nền tối đồng điệu với modal */
    border-radius: 10px !important;
}

/* Định dạng con trỏ chạy (Thanh kéo chính) */
.modal-scroll-clean::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.2) !important; /* Màu xanh Diamond mờ dịu mắt */
    border-radius: 10px !important;
    border: 1px solid rgba(0, 212, 255, 0.1) !important;
    transition: background 0.3s ease;
}

/* Phát sáng nhẹ thanh kéo khi anh Thắng rê chuột vào cuộn lệnh */
.modal-scroll-clean::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 212, 255, 0.6) !important; /* Phát sáng rực rỡ hơn khi tương tác */
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.4) !important;
}

/* Hỗ trợ tương thích thanh cuộn tối giản cho trình duyệt Firefox */
.modal-scroll-clean {
    scrollbar-width: thin !important;
    scrollbar-color: rgba(0, 212, 255, 0.2) rgba(0, 0, 0, 0.4) !important;
}
/* --- 13. NÂNG CẤP WIDGET ĐIỀU KHIỂN & NÚT BẤM PREMIUM ZALO --- */
#vol-control {
    width: 60px;
    height: 3px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    cursor: pointer;
    accent-color: #00d4ff;
    
    /* 💎 FIX LỖI: Bổ sung đầy đủ các tiền tố và thuộc tính chuẩn appearance để xóa lỗi cảnh báo compiler */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none; 
}

/* Định dạng con trỏ chạy (slider thumb) trên các trình duyệt lõi Webkit */
#vol-control::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none; /* Bổ sung tại đây */
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00d4ff;
    box-shadow: 0 0 6px #00d4ff;
    transition: transform 0.15s ease;
}

/* Định dạng con trỏ chạy trên trình duyệt Firefox */
#vol-control::-moz-range-thumb {
    width: 8px;
    height: 8px;
    border: none;
    border-radius: 50%;
    background: #00d4ff;
    box-shadow: 0 0 6px #00d4ff;
    transition: transform 0.15s ease;
}

#vol-control::-webkit-slider-thumb:hover {
    transform: scale(1.4);
}
#vol-control::-moz-range-thumb:hover {
    transform: scale(1.4);
}
/* ==============================================================================
   DIAMOND FLOW - 3D FALLING LEAVES ARTWORK STYLING
   ============================================================================== */

/* Tạo hình dáng chiếc lá phong góc cạnh tinh tế bằng clip-path hình thoi đa điểm */
.leaf {
    position: absolute;
    top: -40px; /* Xuất phát khuất phía trên màn hình */
    pointer-events: none;
    z-index: 1;
    clip-path: polygon(50% 0%, 65% 25%, 100% 35%, 75% 55%, 85% 90%, 50% 75%, 15% 90%, 25% 55%, 0% 35%, 35% 25%);
    transform-style: preserve-3d;
    backface-visibility: visible;
    opacity: 0.8;
}

/* 1. LỆNH ĐIỀU HƯỚNG CHÍNH: Rơi thẳng đứng từ trên đỉnh xuống đáy màn hình mượt mà */
@keyframes fall-down {
    0% {
        top: -40px;
        opacity: 0;
    }
    10% {
        opacity: 0.85;
    }
    90% {
        opacity: 0.85;
    }
    100% {
        top: 105vh;
        opacity: 0;
    }
}

/* 2. CHU KỲ LẮC HÌNH SIN 1: Lá uốn lượn từ Trái sang Phải kèm lật nghiêng lướt mặt 3D */
@keyframes sway-left-to-right {
    0% {
        transform: translateX(0px) rotate(0deg) rotateY(0deg);
    }
    25% {
        transform: translateX(60px) rotate(35deg) rotateX(120deg) rotateY(30deg);
    }
    50% {
        transform: translateX(0px) rotate(0deg) rotateX(240deg) rotateY(0deg);
    }
    75% {
        transform: translateX(-60px) rotate(-35deg) rotateX(360deg) rotateY(-30deg);
    }
    100% {
        transform: translateX(0px) rotate(0deg) rotateX(480deg) rotateY(0deg);
    }
}

/* 3. CHU KỲ LẮC HÌNH SIN 2: Đảo chiều ngược lại tạo sự so le, bất đối xứng tự nhiên giữa các lá */
@keyframes sway-right-to-left {
    0% {
        transform: translateX(0px) rotate(0deg) rotateX(0deg) rotateY(0deg);
    }
    25% {
        transform: translateX(-50px) rotate(-30deg) rotateX(-100deg) rotateY(-40deg);
    }
    50% {
        transform: translateX(0px) rotate(0deg) rotateX(-200deg) rotateY(0deg);
    }
    75% {
        transform: translateX(50px) rotate(30deg) rotateX(-300deg) rotateY(40deg);
    }
    100% {
        transform: translateX(0px) rotate(0deg) rotateX(-400deg) rotateY(0deg);
    }
}

/* Ép biến thời gian chạy động custom từ Javascript đồng bộ khớp tốc độ uốn lượn */
.leaf {
    animation-duration: var(--leaf-duration), var(--leaf-duration);
    animation-iteration-count: infinite, infinite;
    animation-timing-function: linear, ease-in-out;
}