/* AI Trading Journal - Standalone PWA CSS */

:root {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --input-bg: #0f172a;
  --brand-blue: #3b82f6;
  --brand-blue-hover: #2563eb;
  --profit-green: #22c55e;
  --profit-bg: rgba(34, 197, 94, 0.15);
  --loss-red: #ef4444;
  --loss-bg: rgba(239, 68, 68, 0.15);
  --warning-amber: #f59e0b;
  --nav-bg: rgba(15, 23, 42, 0.95);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

body.light-theme {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --input-bg: #f8fafc;
  --brand-blue: #2563eb;
  --brand-blue-hover: #1d4ed8;
  --profit-green: #16a34a;
  --profit-bg: rgba(22, 163, 74, 0.1);
  --loss-red: #dc2626;
  --loss-bg: rgba(220, 38, 38, 0.1);
  --warning-amber: #d97706;
  --nav-bg: rgba(255, 255, 255, 0.95);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 80px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

/* Header */
.top-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-logo {
  width: 36px;
  height: 36px;
  background: var(--brand-blue);
  color: white;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
}

.brand-text h1 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.brand-badge {
  font-size: 10px;
  background: rgba(59, 130, 246, 0.2);
  color: var(--brand-blue);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.brand-text p {
  font-size: 11px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* PWA Install Banner */
.pwa-banner {
  background: linear-gradient(90deg, #1e40af, #3b82f6);
  color: white;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
}
.btn-install {
  background: white;
  color: #1e40af;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

/* Main Content Layout */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
}

.tab-sec {
  display: block;
}
.tab-sec.hidden {
  display: none !important;
}

/* Cards & Layout */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;

  color: var(--text-main);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 640px) {
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 14px;
}
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.form-control:focus {
  border-color: var(--brand-blue);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}
.btn-primary {
  background-color: var(--brand-blue);
  color: white;
}
.btn-primary:hover {
  background-color: var(--brand-blue-hover);
}
.btn-secondary {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-danger {
  background-color: var(--loss-red);
  color: white;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  min-height: 32px;
}
.btn-full {
  width: 100%;
}

/* Stat Badge */
.stat-box {
  background: var(--input-bg);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
}
.stat-value {
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
}

.text-profit { color: var(--profit-green); }
.text-loss { color: var(--loss-red); }

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 6px 0;
}
.nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  cursor: pointer;
  flex: 1;
  transition: color 0.2s;
}
.nav-btn .nav-icon {
  font-size: 18px;
  margin-bottom: 2px;
}
.nav-btn.active {
  color: var(--brand-blue);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
}

/* Calendar Grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
  margin-top: 10px;
}
.cal-head {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 6px 0;
}
.cal-day {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  min-height: 52px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  cursor: pointer;
}
.cal-day.profit {
  background: var(--profit-bg);
  border-color: rgba(34, 197, 94, 0.4);
}
.cal-day.loss {
  background: var(--loss-bg);
  border-color: rgba(239, 68, 68, 0.4);
}
.cal-day-num {
  font-weight: 700;
}
.cal-day-pnl {
  font-size: 9px;
  font-weight: 700;
}

/* Scaled Entry Calculator Widget */
.calc-widget {
  background: var(--input-bg);
  border: 1px solid var(--brand-blue);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.tag-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.15);
  color: var(--brand-blue);
  border: 1px solid rgba(59, 130, 246, 0.3);
  margin-right: 4px;
}
