/* Journal Variables */
:root {
  --profit-color: #00e676;
  --loss-color: #ff4757;
  --profit-bg: rgba(0, 230, 118, 0.15);
  --loss-bg: rgba(255, 71, 87, 0.15);
}

/* Layout */
.journal-wrapper {
  max-width: 1200px;
  margin: 3rem auto 6rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Dashboard Stats */
.journal-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
  position: relative;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.stat-card:hover::before {
  opacity: 1;
}

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

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon svg {
  width: 28px;
  height: 28px;
}

.icon-profit { background: var(--profit-bg); color: var(--profit-color); border: 1px solid rgba(0,230,118,0.3); }
.icon-rate { background: rgba(125, 42, 232, 0.2); color: var(--accent-color-light); border: 1px solid rgba(125,42,232,0.3); }
.icon-total { background: rgba(255, 255, 255, 0.1); color: #fff; border: 1px solid rgba(255,255,255,0.2); }

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
}

.text-profit { color: var(--profit-color); text-shadow: 0 0 10px rgba(0,230,118,0.3); }
.text-loss { color: var(--loss-color); text-shadow: 0 0 10px rgba(255,71,87,0.3); }

/* Toolbar */
.journal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
}

.toolbar-filters {
  display: flex;
  gap: 0.5rem;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 0.6rem 1.2rem;
  border-radius: 100px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.filter-btn.active {
  background: rgba(125, 42, 232, 0.2);
  border-color: var(--accent-color-light);
  color: #fff;
}

/* Journal Grid */
.journal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
}

.trade-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  transition: transform 0.3s ease;
  position: relative;
  overflow: hidden;
}

.trade-card:hover {
  transform: translateY(-4px);
}

.trade-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.2rem;
}

.trade-badge {
  padding: 0.3rem 0.8rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.trade-badge.badge-buy { background: rgba(255,255,255,0.1); color: #fff; }
.trade-badge.badge-sell-profit { background: var(--profit-bg); color: var(--profit-color); border: 1px solid rgba(0,230,118,0.3); }
.trade-badge.badge-sell-loss { background: var(--loss-bg); color: var(--loss-color); border: 1px solid rgba(255,71,87,0.3); }

.trade-date {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.trade-stock-name {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text-primary);
}

.trade-stock-code {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.trade-details {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.detail-value {
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.trade-tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  color: var(--text-secondary);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  padding: 2.5rem;
  transform: translateY(20px);
  transition: transform 0.3s ease;
  position: relative;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.modal-title {
  font-size: 1.5rem;
  font-family: 'Space Grotesk', sans-serif;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  transition: color 0.2s;
}

.btn-close:hover {
  color: #fff;
}

/* Form Groups */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s, background 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent-color-light);
  background: rgba(255,255,255,0.06);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-row {
  display: flex;
  gap: 1rem;
}
.form-row .form-group {
  flex: 1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
}

@media (max-width: 768px) {
  .journal-toolbar {
    flex-direction: column;
    gap: 1.5rem;
  }
  .toolbar-filters {
    width: 100%;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
  .journal-toolbar .btn-primary {
    width: 100%;
  }
}
