/* assets/css/pages/portfolio.css
   portfolio.html එකේ තිබුණු inline <style> block 3ක් මෙතනට ගෙනාවා.
   Router එක navigate කරනකොට මේ file එක <link id="page-style"> එකට load කරනවා. */

/* --- Enhanced Base Styles for a Beautiful Modern UI --- */
        html { scroll-behavior: smooth; }
        body {
            font-family: 'Inter', sans-serif;
            background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
            background-attachment: fixed;
            color: #e2e8f0;
            min-height: 100vh;
            position: relative;
            overflow-x: hidden;
        }
        
        body::before {
            content: '';
            position: fixed;
            top: 10%;
            left: 15%;
            width: 50vw;
            height: 50vw;
            border-radius: 50%;
            background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
            z-index: 0;
            animation: float 15s infinite alternate ease-in-out;
        }

        body::after {
            content: '';
            position: fixed;
            bottom: 10%;
            right: 15%;
            width: 40vw;
            height: 40vw;
            border-radius: 50%;
            background: radial-gradient(circle, rgba(168, 85, 247, 0.15) 0%, transparent 70%);
            z-index: 0;
            animation: float 20s infinite alternate-reverse ease-in-out;
        }

        @keyframes float {
            0% { transform: translate(0, 0); }
            100% { transform: translate(5%, 5%); }
        }
        ::-webkit-scrollbar { width: 10px; }
        ::-webkit-scrollbar-track { background: rgba(30, 41, 59, 0.3); border-radius: 5px; }
        ::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #3b82f6, #8b5cf6); border-radius: 5px; border: 2px solid rgba(30, 41, 59, 0.3); }
        ::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #2563eb, #7c3aed); }

        /* Card Styles - Glassmorphism */
        .card {
            background: rgba(30, 41, 59, 0.7);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border-radius: 0.75rem;
            border: 1px solid rgba(255, 255, 255, 0.05);
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
            transition: all 0.3s;
        }

        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }
        /* Button Styles */
        .btn {
            transition: all 0.3s;
            font-weight: 600;
            border-radius: 0.75rem;
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .btn-primary {
            background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        }

        .btn-secondary {
            background: linear-gradient(135deg, #64748b 0%, #475569 100%);
        }

        .btn-danger {
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
        }

        /* Modal Styles */
        .custom-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(15, 23, 42, 0.7);
            backdrop-filter: blur(5px);
            -webkit-backdrop-filter: blur(5px);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }
        
        .modal-content {
            background-color: rgba(30, 41, 59, 0.8);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.05);
            border-radius: 0.75rem;
        }
        
        /* Spinner Animation */
        .spinner {
            border: 3px solid rgba(59, 130, 246, 0.1);
            border-radius: 50%;
            border-top: 3px solid #3b82f6;
            width: 40px;
            height: 40px;
            animation: spin 0.8s ease-in-out infinite;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        .form-input, .settings-input, .currency-select {
            background: rgba(30, 41, 59, 0.8); border: 1px solid rgba(71, 85, 105, 0.3); color: #f8fafc;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); border-radius: 0.75rem; backdrop-filter: blur(10px);
        }
        .form-input:focus, .settings-input:focus, .currency-select:focus {
            background: rgba(51, 65, 85, 0.9); border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3), 0 4px 12px rgba(59, 130, 246, 0.2);
            outline: none; transform: translateY(-2px);
        }

        input[type="file"]::file-selector-button {
            background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: white; border: none;
            padding: 0.75rem 1.5rem; border-radius: 0.75rem; cursor: pointer;
            transition: all 0.3s ease; font-weight: 600; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
        }
        input[type="file"]::file-selector-button:hover { background: linear-gradient(135deg, #2563eb, #7c3aed); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4); }

        .btn { transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); font-weight: 600; border-radius: 0.75rem; position: relative; overflow: hidden; }
        .btn::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 1s; }
        .btn:hover::before { left: 100%; }
        .btn-primary { background: linear-gradient(135deg, #3b82f6, #8b5cf6); box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4); border: none; }
        .btn-primary:hover { background: linear-gradient(135deg, #2563eb, #7c3aed); transform: translateY(-3px); box-shadow: 0 12px 35px rgba(59, 130, 246, 0.5); }
        .btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4); border: none; }
        .btn-danger:hover { background: linear-gradient(135deg, #dc2626, #b91c1c); transform: translateY(-3px); box-shadow: 0 12px 35px rgba(239, 68, 68, 0.5); }
        .btn-secondary { background: linear-gradient(135deg, #475569, #64748b); box-shadow: 0 4px 15px rgba(71, 85, 105, 0.3); border: none; }
        .btn-secondary:hover { background: linear-gradient(135deg, #64748b, #94a3b8); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(71, 85, 105, 0.4); }

        .loader, .spinner { border: 4px solid rgba(59, 130, 246, 0.2); border-radius: 50%; border-top: 4px solid #3b82f6; width: 50px; height: 50px; animation: spin 1.2s linear infinite; box-shadow: 0 0 20px rgba(59, 130, 246, 0.3); }
        .chart-spinner { width: 30px; height: 30px; }
        @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

        .custom-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: flex; justify-content: center; align-items: center; z-index: 1000; animation: modal-fade-in 0.3s ease-out; }
        @keyframes modal-fade-in { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
        .modal-content { background: rgba(15, 23, 42, 0.95); border: 1px solid rgba(59, 130, 246, 0.3); box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(59, 130, 246, 0.1); }

        .time-range-btn.active, .add-trade-mode-btn.active { background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: #ffffff; box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4); }
        .active-nav { background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: white !important; font-weight: 600; box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3); }
        .profit { color: #10b981; } .loss { color: #ef4444; }

        /* Updated Sidebar Styles */
        #sidebar {
            width: 5rem;
            transition: width 0.3s ease-out;
        }
        #sidebar:hover {
            width: 16rem;
        }
        
        .logo-container {
            display: flex;
            align-items: center;
            overflow: hidden;
            width: 100%;
            height: 100%;
        }
        
        #sidebar .logo-container {
            justify-content: center;
            width: 5rem;
        }

        .logo-icon {
            transition: margin-right 0.3s ease-out;
            flex-shrink: 0;
        }
        
        .logo-text {
            white-space: nowrap;
            overflow: hidden;
            opacity: 0;
            transform: translateX(20px);
            transition: opacity 0.3s ease-out, transform 0.3s ease-out;
            font-size: 1.5rem;
            font-weight: 800;
            color: #5ea4fa;
        }
        
        #sidebar:hover .logo-container {
             justify-content: flex-start;
             padding-left: 20px;
             width: 100%;
        }

        #sidebar:hover .logo-icon {
            margin-right: 12px;
        }
        
        #sidebar:hover .logo-text {
            opacity: 1;
            transform: translateX(0);
            transition-delay: 0.1s;
        }
        
        .nav-item > i, .nav-item > svg { flex-shrink: 0; }
        .nav-item span, #profile-username, .profile-more-icon { opacity: 0; white-space: nowrap; transition: opacity 0.15s ease-out, max-width 0.2s ease-out; max-width: 0; overflow: hidden; will-change: opacity, max-width; }
        #sidebar:hover .nav-item span, #sidebar:hover #profile-username, #sidebar:hover .profile-more-icon { opacity: 1; transition: opacity 0.15s ease-out 0.05s, max-width 0.2s ease-out; max-width: 120px; }
        #sidebar .nav-item, #sidebar #profile-btn { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; }
        #sidebar:hover .nav-item { justify-content: flex-start; padding-left: 1rem; padding-right: 1rem; gap: 0.75rem; }
        #sidebar:hover #profile-btn { justify-content: flex-start; padding: 0.5rem; gap: 0.75rem; }

        .sidebar-text-slide {
            transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
            transform: translateX(-10px);
            opacity: 0;
            display: block;
        }

        #sidebar:hover .sidebar-text-slide {
            transform: translateX(0);
            opacity: 1;
        }

        .sidebar-icon-fade {
            transition: opacity 0.3s ease-in-out;
        }

        #sidebar:hover .sidebar-icon-fade {
            opacity: 0.8;
        }
        
        .tab-active { background: linear-gradient(135deg, #3b82f6, #8b5cf6); color: white; font-weight: 600; }
        .tab-inactive { background: transparent; color: #9ca3af; }
        
        .skeleton-loader { background-color: #334155; border-radius: 0.5rem; animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
        @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
        
        th[data-sortable] { cursor: pointer; user-select: none; }
        th[data-sortable]:hover { color: #e2e8f0; }
        .sort-indicator { display: inline-block; width: 1em; text-align: center; }

        .asset-row { cursor: pointer; }
        .transaction-details-row { display: none; }
        .transaction-details-row.expanded { display: table-row; }
        .transaction-details-content { background-color: rgba(30, 41, 59, 0.5); }

        /* SINHALA: AI Chatbot සඳහා වන Styles */
        #ai-chat-button {
            position: fixed; bottom: 20px; right: 20px;
            z-index: 1010;
            width: 60px; height: 60px;
            background: linear-gradient(135deg, #3b82f6, #8b5cf6);
            border-radius: 50%;
            display: flex; justify-content: center; align-items: center;
            cursor: pointer; box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
            transition: all 0.3s ease;
        }
        #ai-chat-button:hover {
            transform: scale(1.1) translateY(-3px);
            box-shadow: 0 12px 35px rgba(59, 130, 246, 0.5);
        }
        #ai-chat-window {
            position: fixed; bottom: 100px; right: 20px;
            width: 90vw; max-width: 400px;
            height: 60vh; max-height: 500px;
            z-index: 1009;
            display: flex; flex-direction: column;
            background: rgba(15, 23, 42, 0.9);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid rgba(59, 130, 246, 0.3);
            border-radius: 1rem;
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
            transform-origin: bottom right;
            transition: transform 0.3s ease-out, opacity 0.3s ease-out;
            transform: scale(0.95); opacity: 0;
            pointer-events: none;
        }
        #ai-chat-window.open {
            transform: scale(1);
            opacity: 1;
            pointer-events: auto;
        }
        .message-bubble { max-width: 85%; }
        /* SINHALA: User message එක දකුණු පැත්තෙන් පෙන්වීමට style එක වෙනස් කිරීම */
        .user-message { background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; }
        .bot-message { background: #334155; color: #e2e8f0; }
        /* SINHALA: Bot message එකේ code block සඳහා style */
        .bot-message pre {
            background-color: #1e293b;
            padding: 0.75rem;
            border-radius: 0.5rem;
            white-space: pre-wrap;
            word-wrap: break-word;
            font-family: monospace;
            font-size: 0.875rem;
        }
        
        /* SINHALA: AI Assistant loading animation සඳහා styles */
        .typing-indicator {
            display: flex;
            align-items: center;
            padding: 8px 0; /* Add some padding */
        }
        .typing-indicator span {
            height: 8px;
            width: 8px;
            margin: 0 2px;
            background-color: #9ca3af;
            border-radius: 50%;
            display: inline-block;
            animation: bounce 1.4s infinite ease-in-out both;
        }
        .typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
        .typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

        @keyframes bounce {
            0%, 80%, 100% { transform: scale(0); }
            40% { transform: scale(1.0); }
        }

        /* SINHALA: Grid View සඳහා වන Styles */
        .view-toggle-btn.active {
            background: linear-gradient(135deg, #3b82f6, #8b5cf6);
            color: white;
        }
        #assets-grid-view {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            gap: 1rem;
        }
        .asset-card {
            cursor: pointer;
            padding: 1rem;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

/* ---- */

:root{
  --surface: 10 10 14;
  --glass: rgba(32, 34, 44, 0.55);
  --glass-strong: rgba(24, 26, 36, 0.72);
  --ring: 255 255 255 / 0.08;
  --grad-a:#3b82f6; --grad-b:#8b5cf6;
  --success:#22c55e; --danger:#ef4444;
  --radius:18px; --radius-lg:22px;
  --blur:16px; --blur-heavy:24px;
}

/* Background & typography */
html{scroll-behavior:smooth}
body{
  background: radial-gradient(1200px 600px at 20% -5%, rgba(99,102,241,0.16), transparent 40%),
              radial-gradient(900px 500px at 110% 10%, rgba(59,130,246,0.14), transparent 44%),
              linear-gradient(135deg, #0b0f1a, #0f172a 50%, #151a2b) !important;
  color: #e2e8f0;
}

/* Universal glass cards */
.card, .rounded-lg.bg-slate-800, .bg-slate-800, .bg-slate-900, .shadow, .shadow-lg{
  background: linear-gradient(180deg, rgba(35,39,55,0.58), rgba(24,26,36,0.44)) !important;
  backdrop-filter: blur(var(--blur)) saturate(1.15) !important;
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.15) !important;
  border-radius: var(--radius-lg) !important;
  border: 1px solid rgb(var(--ring)) !important;
  box-shadow:
    0 14px 36px rgba(0,0,0,.40),
    inset 0 1px 0 rgba(255,255,255,.04) !important;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card:hover, .rounded-lg.bg-slate-800:hover, .bg-slate-800:hover{
  transform: translateY(-6px);
  border-color: rgba(99,102,241,.35) !important;
  box-shadow:
    0 22px 60px rgba(0,0,0,.55),
    0 0 0 1px rgba(99,102,241,.20) inset !important;
}

/* Buttons */
button, .btn, .px-4.py-2, .icon-button, .inline-flex.items-center.py-2, .rounded-md{
  border-radius: 14px !important;
  border: 1px solid rgb(var(--ring)) !important;
  background: rgba(36,38,48,0.55) !important;
  box-shadow: 0 8px 22px rgba(0,0,0,.28) !important;
  transition: transform .18s ease, background .18s ease;
}
button:hover, .btn:hover, .px-4.py-2:hover, .icon-button:hover{ transform: translateY(-2px) }
.btn-primary, .bg-blue-600, .text-white.bg-blue-600{
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b)) !important;
  color:#fff !important;
}
.btn-danger, .bg-red-600{ background: linear-gradient(135deg, #ef4444, #dc2626) !important; color:#fff !important; }
.btn-secondary, .bg-slate-700{ background: linear-gradient(135deg, #64748b, #475569) !important; color:#fff !important; }

/* Sidebar (if present) */
#sidebar{
  background: rgba(14, 16, 24, 0.65) !important;
  backdrop-filter: blur(var(--blur)) !important;
  border-right: 1px solid rgb(var(--ring)) !important;
}
#sidebar .nav-item{ border-radius: 12px !important; }
#sidebar .nav-item:hover{ background: rgba(71,85,105,0.35) !important; }
.active-nav, .text-white.bg-slate-700{
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b)) !important;
  color: #fff !important;
  box-shadow: 0 8px 26px rgba(67,56,202,0.35) !important;
}

/* Tables / list rows */
table thead th{
  background: rgba(59,130,246,0.12) !important;
  color: #e8eefc !important;
}
tbody tr:hover td{ background: rgba(255,255,255,0.02) !important; }
tbody td{ border-top: 1px solid rgb(255 255 255 / 0.06) !important; }

/* Modals */
.custom-modal{
  background-color: rgba(2,6,23,.55) !important;
  backdrop-filter: blur(var(--blur-heavy)) saturate(1.05) !important;
  -webkit-backdrop-filter: blur(var(--blur-heavy)) saturate(1.05) !important;
  padding: 16px !important;
}
.modal-content{
  background: linear-gradient(180deg, var(--glass-strong), rgba(15,23,42,0.82)) !important;
  border-radius: 18px !important;
  border:1px solid rgb(var(--ring)) !important;
  box-shadow: 0 24px 70px rgba(0,0,0,.58), 0 0 0 1px rgba(255,255,255,.03) inset !important;
}

/* Inputs */
input, select, textarea, .form-input, .settings-input, .currency-select{
  background: rgba(30, 41, 59, 0.8) !important;
  border: 1px solid rgba(71, 85, 105, 0.3) !important;
  color: #f8fafc !important;
  border-radius: 12px !important;
  backdrop-filter: blur(10px) !important;
}
input:focus, select:focus, textarea:focus, .form-input:focus, .settings-input:focus, .currency-select:focus{
  background: rgba(51,65,85,0.9) !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.3), 0 4px 12px rgba(59,130,246,0.2) !important;
  outline: none !important;
  transform: translateY(-2px);
}

/* Scrollbar */
::-webkit-scrollbar{ width:10px; height:10px }
::-webkit-scrollbar-track{ background: rgba(30,41,59,.22); border-radius:8px }
::-webkit-scrollbar-thumb{
  background: linear-gradient(180deg, var(--grad-a), var(--grad-b));
  border-radius:8px; border:2px solid rgba(30,41,59,.30);
}

/* Chips / badges */
.badge, .rounded-full.px-3.py-1{
  background: rgba(36, 38, 48, 0.55) !important;
  border: 1px solid rgb(var(--ring)) !important;
  backdrop-filter: blur(10px) !important;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  *{ animation:none !important; transition:none !important }
}

/* ---- */

/* Reduce expensive effects near charts & sidebar without touching JS/HTML */
body:has(canvas) #sidebar{
  backdrop-filter: blur(6px) saturate(1.0) !important;
  -webkit-backdrop-filter: blur(6px) saturate(1.0) !important;
  box-shadow: none !important;
  border-right-color: rgb(255 255 255 / 0.05) !important;
}

/* Any card that contains a canvas: make it less glassy */
.card:has(canvas),
:where(.bg-slate-800,.bg-slate-900,.shadow,.shadow-lg):has(canvas){
  backdrop-filter: blur(4px) saturate(1.0) !important;
  -webkit-backdrop-filter: blur(4px) saturate(1.0) !important;
  background: rgba(20,22,30,0.60) !important;
  box-shadow: 0 6px 16px rgba(0,0,0,.35) !important;
  border-color: rgb(255 255 255 / 0.06) !important;
}

/* Canvas itself: avoid filters/transitions */
canvas{
  filter: none !important;
  transition: none !important;
}

/* General: slightly lower global blur to ease GPU */
:root{ --blur: 10px !important; --blur-heavy: 16px !important; }

/* If charts are inside .chart-container/.chart class names, help them too */
.chart-container, .chart{
  background: rgba(17,19,27,0.55) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  box-shadow: 0 6px 16px rgba(0,0,0,.30) !important;
}

/* Respect reduced motion = extra perf savings */
@media (prefers-reduced-motion: reduce){
  *{ animation: none !important; transition: none !important }
}
