
/* =====================================
   FINORA - EMERALD FINANCE THEME
===================================== */

:root {
  --dark: #103B35;
  --primary: #176B5B;
  --mint: #38B89A;
  --background: #F2F7F5;
  --white: #FFFFFF;
  --text: #183B34;
  --muted: #71857F;
  --border: #DCE9E3;
  --green-light: #E6F4EF;
  --red: #D65B5B;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: var(--background);
  color: var(--text);
}

button, input, select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
  width: 245px;
  min-height: 100vh;
  background: var(--dark);
  color: white;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 35px;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: 2px;
}

.brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.navigation {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link {
  display: block;
  color: #C5D9D2;
  text-decoration: none;
  padding: 14px 15px;
  border-radius: 9px;
  font-size: 14px;
  transition: .2s;
}

.nav-link:hover,
.nav-link.active {
  background: var(--primary);
  color: white;
}

.sidebar-footer {
  margin-top: auto;
  padding: 20px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #C5D9D2;
  font-size: 12px;
}

.sidebar-footer small {
  color: #8FAFA4;
}

/* MAIN */

.main {
  flex: 1;
  min-width: 0;
}

.topbar {
  min-height: 85px;
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 18px 35px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h2 {
  font-size: 20px;
  margin-bottom: 5px;
}

.topbar p {
  color: var(--muted);
  font-size: 12px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.status {
  color: var(--primary);
  background: var(--green-light);
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 11px;
}

.refresh-btn {
  border: none;
  background: var(--dark);
  color: white;
  padding: 11px 16px;
  border-radius: 8px;
  transition: .2s;
}

.refresh-btn:hover {
  background: var(--primary);
}

.content {
  padding: 30px 35px;
  max-width: 1600px;
  margin: auto;
}

/* PAGES */

.page {
  display: none;
  animation: appear .3s ease;
}

.page.active {
  display: block;
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-intro {
  margin-bottom: 25px;
}

.page-intro h1 {
  font-size: 27px;
  margin-bottom: 9px;
}

.page-intro p {
  color: var(--muted);
  font-size: 14px;
}

/* WELCOME */

.welcome-banner {
  background: linear-gradient(120deg, #103B35, #176B5B);
  color: white;
  border-radius: 15px;
  padding: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
}

.eyebrow {
  color: #9DE3CD;
  font-size: 11px;
  letter-spacing: 2px;
  font-weight: bold;
}

.welcome-banner h1 {
  font-size: 27px;
  margin: 13px 0;
  max-width: 600px;
  line-height: 1.4;
}

.welcome-banner p {
  color: #D3E7DF;
  font-size: 13px;
  line-height: 1.7;
}

.welcome-date {
  color: #D3E7DF;
  font-size: 13px;
  white-space: nowrap;
}

/* CARDS */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  transition: .2s;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(16, 59, 53, .06);
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

.stat-card h2 {
  font-size: 25px;
  margin: 13px 0 8px;
  color: var(--text);
}

.stat-card p {
  font-size: 12px;
}

/* PANELS */

.panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 23px;
  margin-bottom: 22px;
  min-width: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-header h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.panel-header p {
  font-size: 12px;
  color: var(--muted);
}

.period-label {
  background: var(--green-light);
  color: var(--primary);
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 11px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 22px;
}

.chart-panel canvas {
  width: 100% !important;
  max-height: 300px;
}

/* MARKET SUMMARY */

.market-summary {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 20px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.summary-item:last-child {
  border-bottom: none;
}

.summary-item span {
  color: var(--muted);
  font-size: 13px;
}

.summary-item strong {
  color: var(--text);
  font-size: 13px;
}

/* PERFORMERS */

.dashboard-lower-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 22px;
}

.performer-list {
  margin-top: 18px;
}

.performer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 5px;
  border-bottom: 1px solid var(--border);
}

.performer-row:last-child {
  border-bottom: none;
}

.performer-row div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.performer-row strong {
  color: var(--text);
  font-size: 14px;
}

.performer-row small {
  color: var(--muted);
  font-size: 12px;
}

.performer-row > span {
  font-weight: 700;
  font-size: 14px;
}

.dashboard-note {
  color: var(--muted);
  line-height: 1.8;
  font-size: 14px;
  margin: 18px 0;
}

.demo-label {
  display: inline-block;
  background: var(--green-light);
  color: var(--primary);
  padding: 7px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

/* COLORS */

.positive {
  color: #19966F !important;
}

.negative {
  color: var(--red) !important;
}

/* TABLES */

.table-container {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 450px;
}

th {
  text-align: left;
  padding: 15px;
  background: #F5F9F7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

td {
  padding: 16px 15px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

tbody tr:hover {
  background: #F7FAF8;
}

/* BOURSE SEARCH */

.stock-toolbar {
  display: flex;
  gap: 15px;
  margin: 18px 0 12px;
  flex-wrap: wrap;
}

.stock-toolbar input {
  flex: 1;
  min-width: 200px;
}

.stock-toolbar select {
  min-width: 190px;
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font-size: 14px;
}

.stock-count {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 15px;
}

/* INPUTS */

input[type="search"],
input[type="text"],
input[type="number"] {
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--text);
  outline: none;
  width: 100%;
}

input:focus,
select:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(56, 184, 154, .1);
}

/* NEWS */

.news-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.news-card {
  border: 1px solid var(--border);
  padding: 20px;
  border-radius: 10px;
  background: white;
  transition: .2s;
}

.news-card:hover {
  border-color: var(--mint);
  transform: translateY(-2px);
}

.news-card h3 {
  font-size: 15px;
  margin-bottom: 10px;
}

.news-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.news-card small {
  display: block;
  color: var(--primary);
  margin-top: 12px;
  font-size: 11px;
}

/* FUNDING */

.funding-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.funding-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.funding-card h3 {
  margin-bottom: 12px;
}

.funding-card p {
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}

.info-panel p {
  color: var(--muted);
  margin: 15px 0;
  line-height: 1.7;
  font-size: 14px;
}

.info-panel a {
  color: var(--primary);
  font-weight: bold;
  font-size: 13px;
  text-decoration: none;
}

.info-panel a:hover {
  text-decoration: underline;
}

/* IMPORT */

.import-panel {
  padding: 35px;
}

.upload-area {
  text-align: center;
  padding: 25px;
}

.upload-icon {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: var(--green-light);
  color: var(--primary);
  font-size: 30px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
}

.upload-area h3 {
  margin-bottom: 10px;
}

.upload-area p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 18px;
}

.upload-area input {
  display: block;
  max-width: 350px;
  margin: 0 auto 20px;
}

.primary-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 13px 24px;
  border-radius: 8px;
  font-weight: bold;
}

.primary-btn:hover {
  background: var(--dark);
}

.upload-status {
  margin-top: 18px;
  font-size: 13px;
}

.analysis-panel {
  margin-top: 22px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.analysis-stat {
  padding: 15px;
  background: var(--green-light);
  border-radius: 9px;
}

.analysis-stat span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
}

.analysis-stat strong {
  font-size: 17px;
  color: var(--primary);
}

.pdf-content {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 13px;
  color: var(--muted);
  margin-top: 20px;
  max-height: 400px;
  overflow: auto;
}

/* RESPONSIVE */

@media (max-width: 1100px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
    padding: 15px;
  }

  .brand {
    padding: 0 5px 15px;
  }

  .navigation {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 5px;
  }

  .nav-link {
    white-space: nowrap;
    font-size: 12px;
    padding: 11px;
  }

  .sidebar-footer {
    display: none;
  }

  .topbar {
    position: static;
    padding: 18px;
    align-items: flex-start;
  }

  .topbar-right {
    flex-direction: column;
    align-items: flex-end;
  }

  .content {
    padding: 20px 15px;
  }

  .welcome-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-lower-grid,
  .funding-grid {
    grid-template-columns: 1fr;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .cards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 15px;
  }

  .stat-card h2 {
    font-size: 19px;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-right {
    flex-direction: row;
    align-items: center;
  }

  .stock-toolbar {
    flex-direction: column;
  }

  .stock-toolbar select {
    width: 100%;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* =====================================
   IMPORT CHART - SIZE FIX
===================================== */

#importChartPanel {
    width: 100%;
    max-width: 100%;
    margin-top: 20px;
    overflow: hidden;
}

#importChartPanel .chart-container {
    position: relative;
    width: 100%;
    height: 300px;
    max-height: 300px;
}

#importChart {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-height: 300px;
}

@media (max-width: 768px) {
    #importChartPanel .chart-container {
        height: 240px;
        max-height: 240px;
    }
}

/* =====================================
   FINORA - AUTHENTICATION DESIGN
===================================== */

[hidden] {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px 15px;
  background:
    radial-gradient(circle at top left, #DCEFE8, transparent 40%),
    linear-gradient(135deg, #F2F7F5, #E8F2ED);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: white;
  padding: 38px;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 15px 50px rgba(16, 59, 53, .09);
}

.auth-brand {
  text-align: center;
  margin-bottom: 30px;
}

.auth-brand img {
  width: 65px;
  height: 65px;
  object-fit: contain;
}

.auth-brand h1 {
  color: var(--dark);
  font-size: 27px;
  letter-spacing: 3px;
  margin: 10px 0 7px;
}

.auth-brand p {
  color: var(--muted);
  font-size: 13px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  background: var(--background);
  padding: 5px;
  border-radius: 10px;
  margin-bottom: 28px;
}

.auth-tab {
  flex: 1;
  border: none;
  padding: 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  transition: .2s;
}

.auth-tab.active {
  background: var(--dark);
  color: white;
}

#loginForm h2,
#registerForm h2 {
  color: var(--text);
  font-size: 22px;
  margin-bottom: 8px;
}

#loginForm > p:first-of-type,
#registerForm > p:first-of-type {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 24px;
}

#loginForm label,
#registerForm label {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  margin: 17px 0 8px;
}

#loginForm input,
#registerForm input,
#registerForm select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: white;
  color: var(--text);
  transition: .2s;
}

#loginForm input:focus,
#registerForm input:focus,
#registerForm select:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(56, 184, 154, .12);
}

.auth-submit {
  width: 100%;
  margin-top: 25px;
  padding: 14px;
  font-size: 14px;
}

.auth-message {
  margin-top: 15px;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.auth-message.error {
  color: var(--red);
}

.auth-message.success {
  color: var(--primary);
}

.user-account {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 100px;
}

.user-account span {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.user-account small {
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 500px) {
  .auth-card {
    padding: 25px 20px;
  }

  .auth-brand {
    margin-bottom: 22px;
  }

  .auth-screen {
    padding: 15px;
  }

  .user-account {
    display: none;
  }
}
/* تحسين فورم طلب التمويل */
#fundingRequestForm {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

#fundingRequestForm #projectTitle,
#fundingRequestForm #projectDescription {
    grid-column: 1 / -1;
    width: 100%;
}

#fundingRequestForm #projectDescription {
    min-height: 150px;
    resize: vertical;
}

#fundingRequestForm #requestedAmount,
#fundingRequestForm #projectDuration {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#fundingRequestForm button {
    grid-column: 1 / -1;
}

@media (max-width: 600px) {
    #fundingRequestForm {
        grid-template-columns: 1fr;
    }
}

/* FINORA AI BUTTON */
.ai-assistant-btn {
    background: linear-gradient(135deg, #176B5B, #38B89A);
    color: white;
    border: none;
    padding: 10px 17px;
    border-radius: 9px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.25s ease;
}

.ai-assistant-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(23, 107, 91, 0.2);
}

/* =====================================
   FINORA AI - CHAT INTERFACE
===================================== */

.ai-page {
    max-width: 950px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 650px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
}

.ai-header {
    text-align: center;
    padding: 30px 20px 20px;
}

.ai-icon {
    width: 55px;
    height: 55px;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--green-light);
    color: var(--primary);
    font-size: 30px;
}

.ai-header h1 {
    color: var(--dark);
    margin: 0 0 8px;
}

.ai-header p {
    color: var(--muted);
    margin: 0;
}

.ai-chat {
    flex: 1;
    min-height: 350px;
    max-height: 500px;
    overflow-y: auto;
    padding: 25px;
}

.ai-welcome {
    text-align: center;
    padding: 35px 10px;
}

.ai-welcome h2 {
    color: var(--dark);
}

.ai-welcome p {
    color: var(--muted);
}

.ai-suggestions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 650px;
    margin: 25px auto 0;
}

.ai-suggestion {
    padding: 14px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.ai-suggestion:hover {
    border-color: var(--primary);
}

#aiMessages {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ai-message {
    max-width: 80%;
    padding: 13px 16px;
    border-radius: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ai-message.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
}

.ai-message.assistant {
    align-self: flex-start;
    background: var(--background);
    color: var(--text);
}

.ai-input-area {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 18px;
    border-top: 1px solid var(--border);
}

.ai-input-area textarea {
    flex: 1;
    min-width: 0;
    resize: vertical;
    min-height: 48px;
    max-height: 130px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font: inherit;
}

.ai-input-area button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px 20px;
    cursor: pointer;
}

.ai-disclaimer {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    padding: 0 15px 15px;
}

@media (max-width: 600px) {
    .ai-suggestions {
        grid-template-columns: 1fr;
    }

    .ai-message {
        max-width: 95%;
    }
}

