/* ========================================
   BRAIM ESG Analysis Tool - Commercial UI Styles
   ======================================== */

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

/* ==================== 1. Global Variables ==================== */
:root {
  --primary: #0066FF;
  --primary-light: #3D8BFF;
  --primary-dark: #0052CC;
  
  --bg-dark: #0A0E27;
  --bg-card: #131835;
  --bg-card-hover: #1A2142;
  
  --text-primary: #FFFFFF;
  --text-secondary: #B8C5D6;
  --text-muted: #6B7A99;
  
  --accent-green: #00D9A3;
  --accent-purple: #9D4EDD;
  --accent-orange: #FF6B35;
  
  --shadow-sm: 0 2px 8px rgba(0, 102, 255, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 102, 255, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 102, 255, 0.16);
  --shadow-glow: 0 0 40px rgba(0, 102, 255, 0.3);
}

/* ==================== 2. Base Styles ==================== */
html, body, #_dash-root {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: linear-gradient(135deg, #0A0E27 0%, #1A1F3A 100%);
  position: relative;
  overflow-y: auto !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(0, 102, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 102, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  z-index: -1;
  animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
  0% { transform: translate(0, 0); }
  100% { transform: translate(50px, 50px); }
}

body::after {
  content: "";
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at 30% 50%,
    rgba(0, 102, 255, 0.15) 0%,
    transparent 50%
  );
  z-index: -1;
  animation: glowPulse 8s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}

/* ==================== 3. Container Styles ==================== */
.dash-container {
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}

/* ==================== 4. Card Styles ==================== */
.dash-card {
  background: linear-gradient(135deg, 
    rgba(19, 24, 53, 0.95) 0%, 
    rgba(26, 33, 66, 0.95) 100%
  ) !important;
  border-radius: 24px !important;
  border: 1px solid rgba(0, 102, 255, 0.2) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 40px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dash-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--primary) 50%, 
    transparent 100%
  );
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.dash-card:hover {
  border-color: rgba(0, 102, 255, 0.5) !important;
  box-shadow: var(--shadow-glow) !important;
  transform: translateY(-4px);
}

/* ==================== 5. View Container Animation ==================== */
.view-container {
  opacity: 1;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.view-container[style*="opacity: 0"] {
  transform: translateY(20px);
}

/* ==================== 6. Header Styles ==================== */
.dash-card h1 {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 2.5rem;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #FFFFFF 0%, #B8C5D6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeInUp 0.8s ease-out;
}

.dash-card h3 {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.5rem;
  margin-top: 32px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  animation: fadeInUp 1s ease-out;
}

.dash-card h3::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--accent-green) 100%);
  margin-right: 12px;
  border-radius: 2px;
}

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

/* ==================== 7. Upload Area ==================== */
#upload-data {
  background: linear-gradient(135deg, 
    rgba(0, 102, 255, 0.05) 0%, 
    rgba(0, 217, 163, 0.05) 100%
  );
  border: 2px dashed rgba(0, 102, 255, 0.4);
  border-radius: 16px;
  padding: 60px 20px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: fadeInScale 0.8s ease-out 0.3s both;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

#upload-data::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(0, 102, 255, 0.1) 0%,
    transparent 70%
  );
  animation: rotate 10s linear infinite;
  opacity: 0;
  transition: opacity 0.4s;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

#upload-data:hover {
  background: linear-gradient(135deg, 
    rgba(0, 102, 255, 0.1) 0%, 
    rgba(0, 217, 163, 0.1) 100%
  );
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
  cursor: pointer;
}

#upload-data:hover::before {
  opacity: 1;
}

#upload-data i {
  color: var(--primary);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

#upload-data a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  position: relative;
  transition: color 0.3s;
}

#upload-data a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent-green));
  transition: width 0.3s ease;
}

#upload-data a:hover {
  color: var(--primary-light);
}

#upload-data a:hover::after {
  width: 100%;
}

/* ==================== 8. Button Styles ==================== */
.btn-primary,
.btn-outline-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
  border: none !important;
  border-radius: 12px !important;
  padding: 12px 28px !important;
  font-weight: 600 !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: var(--shadow-sm) !important;
  position: relative;
  overflow: hidden;
}

.btn-primary::before,
.btn-outline-primary::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before,
.btn-outline-primary:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary:hover,
.btn-outline-primary:hover {
  transform: translateY(-2px) !important;
  box-shadow: var(--shadow-md) !important;
}

/* ==================== 9. Graph Styles ==================== */
.dash-graph {
  background-color: transparent !important;
  border-radius: 16px;
  padding: 20px;
  animation: fadeIn 1s ease-out 0.5s both;
}

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

.js-plotly-plot {
  border-radius: 16px;
  overflow: hidden;
}

/* ==================== 10. Loading Animation ==================== */
.Spinner {
  border-top-color: var(--primary) !important;
  border-right-color: var(--accent-green) !important;
}

.dash-loading {
  position: relative;
}

.dash-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid rgba(0, 102, 255, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==================== 11. Text Styles ==================== */
.text-muted {
  color: var(--text-secondary) !important;
  animation: fadeIn 1s ease-out 0.4s both;
}

.prose p {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 16px;
}

.prose strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ==================== 12. Divider Styles ==================== */
hr {
  border: none !important;
  height: 1px !important;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(0, 102, 255, 0.3) 50%, 
    transparent 100%
  ) !important;
  margin: 40px 0 !important;
}

/* ==================== 13. Responsive Design ==================== */
@media (max-width: 768px) {
  .dash-card {
    padding: 24px;
    border-radius: 16px !important;
  }
  
  .dash-card h1 {
    font-size: 1.8rem;
  }
  
  .dash-card h3 {
    font-size: 1.25rem;
  }
  
  #upload-data {
    padding: 40px 15px;
  }
}

/* ==================== 14. Scrollbar Styles ==================== */
::-webkit-scrollbar {
  width: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--accent-green));
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

/* ==================== 15. Data Display Optimization ==================== */
#output-filename {
  color: var(--accent-green);
  font-weight: 600;
  padding: 12px 20px;
  background: rgba(0, 217, 163, 0.1);
  border-radius: 8px;
  border-left: 3px solid var(--accent-green);
  animation: slideInRight 0.6s ease-out;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==================== 16. Alert Styles ==================== */
.alert {
  border-radius: 12px !important;
  border: none !important;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}
