@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;700&display=swap');

/* ===== CSS Variables ===== */
:root {
  --primary: #8a2be2; /* A nice shade of purple */
  --secondary: #f8fafc;
  --accent: #0ea5a3;
  --success: #0ea5a3;
  --danger: #ef4444;
  
  /* Light Mode Colors */
  --text-light-mode: #222222; /* Darker text for light mode */
  --bg-light-mode: #f0f0f0; /* Lighter background for light mode */
  --card-light-mode: #ffffff;
  
  /* Dark Mode Colors */
  --text-dark-mode: #eeeeee; /* Lighter text for dark mode */
  --bg-dark-mode: #1a0f2a; /* Darker background for dark mode */
  --card-dark-mode: rgba(42, 31, 58, 0.5); /* Translucent dark panel */
  
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-light: rgba(255,255,255,0.5);
  --glass-dark: rgba(10,14,20,0.5);
}

/* ===== Dark Mode ===== */
body.dark-mode {
  --text-color: var(--text-dark-mode);
  --bg-color: var(--bg-dark-mode);
  --card-bg: var(--card-dark-mode);
  --glass-bg: var(--glass-dark);
}

body.light-mode {
  --text-color: var(--text-light-mode);
  --bg-color: var(--bg-light-mode);
  --card-bg: var(--card-light-mode);
  --glass-bg: var(--glass-light);
}

/* ===== General Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

input, select, textarea, button {
  box-sizing: border-box;
  font-family: inherit;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Roboto Mono', monospace;
  color: var(--text-color);
  background: var(--bg-color);
  transition: background 3.3s ease, color 3.3s ease;
  min-height: 100vh;
  max-width: 100vw;
  animation: gradient 50s ease infinite;
  background-size: 500% 500%;
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

body.dark-mode {
    background-image: linear-gradient(-45deg, #1a0f2a, #2a1f3a, #3a2f4a, #4a3f5a);
}

body.light-mode {
    background-image: linear-gradient(-45deg, #f0f0f0, #e0e0e0, #d0d0d0, #c0c0c0);
}


/* ===== Navbar ===== */
.navbar {
    /* Keep your existing positioning/dimensions */
    position: sticky; /* or fixed */
    top: 0;
    width: 100%;
    z-index: 1000;
    
    /* NEW: Translucent Background */
    /* Dark background with 70% opacity */
    background: rgba(10, 14, 20, 0.7); 
    
    /* The Blur Effect */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); /* For Safari */
    
    /* Subtle border for definition */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    
    /* Spacing */
    padding: 1rem 0;
    transition: background 0.3s ease;
}

/* Optional: Make it more solid when scrolling (requires JS to toggle class) */
.navbar.scrolled {
    background: rgba(10, 14, 20, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* In main.css */

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    
    /* --- THE FIX --- */
    width: 100%;
    
    /* 1. Limit the width so it doesn't stretch forever on big screens */
    max-width: 1200px; 
    
    /* 2. Center the container in the middle of the navbar */
    margin: 0 auto; 
    
    /* 3. Add breathing room on the left and right */
    padding: 0 1.5rem; 
}

.brand {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-color);
}

.navbar-right {
    display: flex;
    align-items: center; /* Vertically center */
    gap: 1.5rem;
}

/* 2. Ensure the links container aligns the Links vs Logout Button */
.nav-links {
    display: flex;
    align-items: center; /* Vertically center */
    gap: 1rem;
}

/* 3. CRITICAL: Ensure the form itself doesn't add invisible margin */
.nav-links form {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-link {
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.95rem;
  transition: opacity 0.2s ease;
  opacity: 0.8;
}

.nav-link:hover {
  opacity: 1;
}

/* --- Hamburger Animation --- */
.hamburger {
    cursor: pointer;
    z-index: 2000; /* Ensure it stays on top of the menu */
    transition: transform 0.3s ease;
    display: none; /* Hidden by default */
}

.hamburger svg {
    transition: transform 0.3s ease;
}

/* The Lines inside the SVG */
.hamburger line {
    transform-origin: center;
    transition: all 0.3s ease;
}

/* When Active (Clicked) -> Turn into X */
.hamburger.active line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.hamburger.active line:nth-child(2) {
    opacity: 0; /* Hide the middle line */
}

.hamburger.active line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ===== Buttons ===== */
.btn {
  background: var(--primary);
  color: #fff;
  padding: 0 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  height: 42px; /* Changed from 38px */
  font-family: 'Roboto Mono', monospace;
  font-size: 1rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  width: 100%;
}

.btn-danger {
  background-color: var(--danger);
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

/* 4. Style the Logout button to align with text */
.btn-logout {
    /* Make it look like a button but align like text */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    
    /* Reset standard button quirks */
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 6px 16px; /* Adjust padding to match your visual preference */
    border-radius: 6px;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    line-height: 1; /* Helps with vertical alignment */
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background: var(--danger);
    color: #fff;
}

/* ===== Dark Mode Toggle ===== */
.theme-toggle {
  background: none;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text-color);
  font-family: 'Roboto Mono', monospace;
}

/* ===== Main Container ===== */
.container {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .container {
    max-width: 1200px;
    padding: 2rem;
  }
}

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

/* ===== Grid Layout ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

/* ===== Card Styles (Glass Morphism) ===== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem;
  transition: all 0.18s ease;
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
  backdrop-filter: blur(10px);
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* ===== Card Header ===== */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
}

.card-icon {
  font-size: 1.5rem;
}

/* ===== Balance Card ===== */
.balance-amount {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-color);
  margin: 0.75rem 0;
}

.balance-label {
  font-size: 0.9rem;
  opacity: 0.7;
  margin-top: 0.5rem;
}

/* ===== Assets Card ===== */
.assets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.asset-item {
  background: transparent;
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  border: 1px solid var(--border-color);
  transition: all 0.18s ease;
  word-break: break-word;
  overflow-wrap: break-word;
}

.asset-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.asset-symbol {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.asset-amount {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0.75rem 0;
  word-break: break-all;
  line-height: 1.3;
}

.asset-price {
  font-size: 0.8rem;
  opacity: 0.6;
  margin-top: 0.5rem;
}

/* ===== Trades History ===== */
.trades-table {
  width: 100%;
  border-collapse: collapse;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

.trades-table th, .trades-table td {
  text-align: center;
}

@media (max-width: 768px) {
  .card:has(.trades-table), .card:has(.user-table) {
    overflow-x: auto;
  }
  
  .trades-table, .user-table {
    min-width: 600px;
    margin: 0;
  }
}

.trades-table thead {
  background: rgba(255, 255, 255, 0.05);
}

.trades-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0.8;
  color: var(--text-color);
  text-align: center;
}

.trades-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-color);
}

.trades-table tbody tr {
  transition: background 0.2s ease;
}

.trades-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.action-buy {
  color: var(--success);
  font-weight: 600;
}

.action-sell {
  color: var(--danger);
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 2rem;
  opacity: 0.6;
  grid-column: 1 / -1;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .hamburger {
        display: block;
        z-index: 1001; /* Above the menu overlay */
    }

    .navbar-right {
        position: fixed;
        top: 0;
        right: -100%; /* Hidden off-screen */
        width: 70%;   /* Cover 70% of screen */
        height: 100vh;
        
        /* Glass Effect matches Navbar */
        background: rgba(10, 14, 20, 0.95);
        backdrop-filter: blur(15px);
        
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: right 0.3s ease;
        z-index: 1500; /* Behind the hamburger (2000) */
        box-shadow: -5px 0 15px rgba(0,0,0,0.5);
    }

    .navbar-right.active {
        right: 0; /* Slide in */
    }

    .nav-links {
        flex-direction: column;
        gap: 2rem;
    }
}

/* --- Navbar Color Override --- */
/* Ensure text is always white because the background is dark glass */
.navbar .brand,
.navbar .nav-link,
.navbar #greeting,
.navbar #clock {
    color: #ffffff !important;
}

/* Ensure the Hamburger menu icon is white */
.navbar .hamburger svg {
    stroke: #ffffff !important;
}

/* Optional: Add a hover effect for links to make them pop */
.navbar .nav-link:hover {
    color: var(--accent) !important; /* Uses your teal color on hover */
}

/* Small mobile devices (480px and below) */
@media (max-width: 480px) {
  .navbar {
    padding: 0.75rem 0.75rem;
  }
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  animation: fadeIn 0.5s ease forwards;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

body.dark-mode ::-webkit-scrollbar-thumb {
  background: #ffffff;
  border-radius: 5px;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: #e0e0e0;
}

body.light-mode ::-webkit-scrollbar-thumb {
  background: #000000;
  border-radius: 5px;
}

body.light-mode ::-webkit-scrollbar-thumb:hover {
  background: #333333;
}

/* Firefox scrollbar styling */
* {
  scrollbar-width: thin;
}

body.dark-mode {
  scrollbar-color: #ffffff var(--bg-color);
}

body.light-mode {
  scrollbar-color: #000000 var(--bg-color);
}

/* ===== Form Styles ===== */
.form-row {
  margin-bottom: 1rem;
}

.form-input, .form-select {
  width: 100%;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  color: var(--text-color);
  height: 42px; /* Changed from 38px */
}

.form-input-light {
  background-color: #fff;
  color: #222222;
}

.form-label {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 0.25rem;
  display: block;
}

.login-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.login-card {
  width: 380px;
  padding: 2rem;
  border-radius: 12px;
}

/* ===== Team Page ===== */
.team-form {
  margin-bottom: 0; /* Remove margin since it's now in its own card */
  display: grid;
  /* This creates columns that are at least 200px wide, but fill space if available */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
  gap: 1.5rem;
  align-items: end;
}

/* Ensure the button fills its column width for better alignment */
.team-form .btn {
  width: 100%; 
}

/* Fix specific alignment for the select dropdown */
.form-select {
  appearance: none; /* Removes default OS styling that can cause clipping */
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23222%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem top 50%;
  background-size: 0.65rem auto;
  padding-right: 2rem; /* Make space for the arrow */
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  box-sizing: border-box;
}

.user-table th, .user-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

/* ===== Modal ===== */
/* ===== Modal with Blur & Centering ===== */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Fixes it to the viewport, not the parent div */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000; /* High value to cover navbar and other elements */
  
  /* Centering */
  align-items: center;
  justify-content: center;
  
  /* Visuals */
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 16px; /* Slightly rounder corners for modern look */
  width: 90%;
  max-width: 400px;
  
  /* Make the modal pop against the blurred background */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); 
  border: 1px solid var(--border-color);
  
  /* Optional: Subtle animation */
  animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Optional: Animation for the modal appearing */
@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-title {
  margin-bottom: 1rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Container for positioning */
.tooltip-container {
  position: relative;
  display: inline-block;
  cursor: pointer;
  margin-left: 8px;
}

/* The "?" Circle Icon */
.help-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background-color: #6c757d;
  color: white;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  font-family: sans-serif;
  transition: background-color 0.2s;
}

.help-icon:hover {
  background-color: #495057;
}

/* ===== Notification System ===== */
.notification-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 3000;
  display: flex;
  align-items: flex-start; /* Position at the top */
  justify-content: center;
  padding-top: 5vh;
  animation: fadeIn 0.3s ease;
}

.notification-box {
  position: relative;
  width: 90%;
  max-width: 500px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-left-width: 5px;
}

.notification-box.notification-success {
  border-left-color: var(--success);
}

.notification-box.notification-danger {
  border-left-color: var(--danger);
}

.notification-box.notification-info {
  border-left-color: var(--primary);
}

.notification-content {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-color);
}

.notification-close-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-color);
  opacity: 0.5;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem;
}

.notification-close-btn:hover {
  opacity: 1;
}

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