/* 
  Portal Grupo OftalmoPlus — Dashboard and Component Styles
  Premium, Corporate & Responsive CSS (Official Identity System)
*/

/* Main Layout Structure */
.portal-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  background-color: #f6f8fa;
}

/* Sidebar Navigation (Navy Blue Brand background) */
.portal-sidebar {
  width: 270px;
  background: var(--color-brand-blue);
  color: var(--color-text-white);
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
  z-index: 100;
  flex-shrink: 0;
  box-shadow: var(--shadow-lg);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.sidebar-title {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 5px;
}

.sidebar-user {
  background: rgba(255, 255, 255, 0.03);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--color-brand-cyan), var(--color-brand-red));
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--color-text-white);
  font-size: 0.95rem;
  box-shadow: 0 0 10px rgba(0, 166, 180, 0.3);
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  color: #ffffff;
}

.user-role {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Sidebar Menu */
.sidebar-menu {
  flex-grow: 1;
  padding: 24px 12px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.menu-item-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
  cursor: pointer;
}

.menu-item-link i {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
  transition: transform var(--transition-fast);
}

.menu-item-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-brand-cyan);
}

.menu-item-link:hover i {
  transform: translateX(2px);
}

.menu-item-link.active {
  background: linear-gradient(135deg, var(--color-brand-cyan), #008f9c);
  color: var(--color-text-white);
  box-shadow: 0 4px 12px rgba(0, 166, 180, 0.25);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Main Content Area */
.portal-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

/* Navbar / Topbar */
.portal-navbar {
  height: 75px;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  z-index: 90;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--color-brand-blue);
  display: none;
}

.navbar-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-brand-blue);
  letter-spacing: -0.5px;
}

/* Filters & Competence selector */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-bg-card);
  padding: 14px 30px;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.filter-select {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-brand-charcoal);
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-select:focus {
  border-color: var(--color-brand-cyan);
  box-shadow: 0 0 0 3px rgba(0, 166, 180, 0.15);
}

/* Main Dashboard Body */
.dashboard-content {
  padding: 30px;
  flex-grow: 1;
  overflow-y: auto;
  animation: fadeIn var(--transition-normal);
}

/* Cards Deck */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 30px;
}

.metric-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(0, 166, 180, 0.2);
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.metric-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: var(--shadow-sm);
}

.metric-icon.primary {
  background: rgba(13, 27, 61, 0.05);
  color: var(--color-brand-blue);
}

.metric-icon.success {
  background: rgba(5, 150, 105, 0.05);
  color: var(--color-success);
}

.metric-icon.reward {
  background: var(--color-reward-bg);
  color: var(--color-reward);
}

.metric-value {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--color-brand-blue);
  line-height: 1.1;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.metric-subtext {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.metric-subtext.up { color: var(--color-success); font-weight: 700; }
.metric-subtext.down { color: var(--color-brand-red); font-weight: 700; }

/* Reward Simulation Alert Box (Golden Identity Accent) */
.reward-simulation-alert {
  background: #fffdf5;
  border-left: 5px solid var(--color-reward);
  padding: 18px 24px;
  border-radius: var(--radius-md);
  margin-bottom: 30px;
  display: flex;
  align-items: flex-start;
  gap: 15px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(217, 119, 6, 0.15);
  animation: slideInLeft var(--transition-normal);
}

.reward-simulation-alert i {
  color: var(--color-reward);
  font-size: 1.4rem;
  margin-top: 2px;
}

.reward-simulation-text h4 {
  color: #92400e;
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 5px;
  letter-spacing: 0.2px;
}

.reward-simulation-text p {
  color: #78350f;
  font-size: 0.9rem;
  line-height: 1.4;
}

.disclaimer-box {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-style: italic;
  line-height: 1.3;
}

/* Layout Split / Rows */
.dashboard-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 30px;
}

.dashboard-row.equal {
  grid-template-columns: 1fr 1fr;
}

.dashboard-row.full {
  grid-template-columns: 1fr;
}

@media (max-width: 1024px) {
  .dashboard-row {
    grid-template-columns: 1fr;
  }
  .dashboard-row.equal {
    grid-template-columns: 1fr;
  }
}

/* Panels / Cards */
.panel-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 24px;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-brand-blue);
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Progress bar styling */
.progress-container {
  margin-bottom: 18px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-brand-charcoal);
}

.progress-bg {
  height: 10px;
  background: #f1f5f9;
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-brand-cyan), #008f9c);
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar.success {
  background: linear-gradient(90deg, var(--color-health-light), var(--color-health));
}

.progress-bar.reward {
  background: linear-gradient(90deg, var(--color-reward-light), var(--color-reward));
}

/* Table Style */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.portal-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.portal-table th {
  background: #f8fafc;
  padding: 14px 18px;
  font-weight: 700;
  color: var(--color-brand-charcoal);
  border-bottom: 2px solid var(--color-border);
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
}

.portal-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-brand-charcoal);
  background-color: var(--color-bg-card);
  font-weight: 500;
}

.portal-table tr:last-child td {
  border-bottom: none;
}

.portal-table tr:hover td {
  background-color: #f8fafc;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.badge.primary { background: #eff6ff; color: #1d4ed8; }
.badge.success { background: #ecfdf5; color: var(--color-success); }
.badge.warning { background: var(--color-reward-bg); color: var(--color-reward); }
.badge.danger { background: var(--color-danger-bg); color: var(--color-brand-red); }
.badge.secondary { background: #f1f5f9; color: var(--color-brand-charcoal); }

/* Form inputs in panels */
.panel-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.input-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-brand-charcoal);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.input-field {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-fast);
  color: var(--color-brand-charcoal);
}

.input-field:focus {
  border-color: var(--color-brand-cyan);
  box-shadow: 0 0 0 3px rgba(0, 166, 180, 0.15);
}

.btn-secondary {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  color: var(--color-brand-charcoal);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-health {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--color-health);
  color: var(--color-text-white);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.2);
  transition: all var(--transition-fast);
}

.btn-health:hover {
  background: var(--color-health-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(5, 150, 105, 0.3);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(7, 14, 32, 0.6);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn var(--transition-fast);
}

.modal-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  box-shadow: var(--shadow-premium);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  animation: fadeInUp var(--transition-normal);
}

.modal-header {
  padding: 22px 28px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-brand-blue);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--color-text-muted);
}

.modal-body {
  padding: 28px;
  overflow-y: auto;
  max-height: 70vh;
}

.modal-footer {
  padding: 18px 28px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 14px;
}

/* Mobile Sidebar Toggle Overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(7, 14, 32, 0.4);
  z-index: 95;
  display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .portal-sidebar {
    position: fixed;
    top: 0;
    left: -270px;
    height: 100%;
  }
  
  .portal-sidebar.open {
    left: 0;
  }
  
  .sidebar-toggle {
    display: block;
  }
}

/* File Upload Drag-and-Drop Area */
.upload-dropzone {
  border: 2px dashed var(--color-border);
  padding: 35px 20px;
  text-align: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: #f8fafc;
  transition: all var(--transition-fast);
}

.upload-dropzone:hover {
  border-color: var(--color-brand-cyan);
  background: #f0fdfa;
}

.upload-dropzone i {
  font-size: 2.8rem;
  color: var(--color-brand-cyan);
  margin-bottom: 15px;
}

.upload-dropzone p {
  font-size: 0.9rem;
  color: var(--color-brand-charcoal);
  font-weight: 500;
}

/* DRE and HTML reports styles */
.html-report-frame {
  width: 100%;
  height: 550px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: white;
}
