/* ==========================================================================
   VEGAS HOMES - FREELANCER & ADMIN PORTAL STYLES (portal.css)
   Modern CRM Dashboard, Metrics, Data Tables, Kanban Pipeline, CRUD Modals
   ========================================================================== */

.portal-wrapper {
  display: flex;
  min-height: 100vh;
  background-color: #f1f5f9;
  color: var(--text-main);
  font-family: var(--font-body);
}

/* Sidebar Navigation */
.portal-sidebar {
  width: 260px;
  background-color: var(--dark-navy);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  border-right: 1px solid var(--border-dark);
  transition: transform 0.3s ease;
}

.portal-sidebar-brand {
  padding: 1.5rem 1.5rem;
  border-bottom: 1px solid var(--border-dark);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.portal-sidebar-brand .brand-title {
  color: #ffffff;
}

.portal-nav-list {
  list-style: none;
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
  overflow-y: auto;
}

.portal-nav-item a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
  text-decoration: none;
}

.portal-nav-item a:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.portal-nav-item.active a {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.portal-nav-item .nav-count {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
}

.portal-sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid var(--border-dark);
  background: rgba(0, 0, 0, 0.2);
}

.portal-user-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.portal-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

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

.portal-user-role {
  font-size: 0.725rem;
  color: var(--primary-light);
  font-weight: 600;
}

/* Main Dashboard Area */
.portal-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

.portal-topbar {
  height: 70px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.portal-topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.portal-page-title {
  font-size: 1.35rem;
  font-weight: 800;
}

.portal-topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.portal-content {
  padding: 2rem;
  flex-grow: 1;
}

/* Stat Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: #ffffff;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.metric-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(13, 148, 136, 0.3);
}

.metric-info h4 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(13, 148, 136, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Portal Data Tables */
.portal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
  overflow: hidden;
}

.portal-card-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.portal-card-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.portal-table th {
  background-color: #f8fafc;
  padding: 0.85rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-light);
}

.portal-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}

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

/* Freelancer Tools Box */
.ref-code-box {
  background: linear-gradient(135deg, var(--dark-slate) 0%, #0f2744 100%);
  color: #ffffff;
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  flex-wrap: wrap;
  gap: 1.5rem;
}

.ref-code-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.12);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent-light);
}

/* Audit Log Timeline */
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.audit-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.audit-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--dark-slate);
  color: #ffffff;
  white-space: nowrap;
}

.audit-content {
  flex-grow: 1;
}

.audit-desc {
  font-size: 0.875rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.audit-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Property Media Manager Styles */
.media-manager-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.media-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dark-navy);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.media-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1.5rem 1rem;
  text-align: center;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.media-dropzone:hover, .media-dropzone.dragover {
  border-color: var(--primary);
  background: rgba(13, 148, 136, 0.04);
}

.gallery-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.gallery-admin-thumb {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 90px;
  background: #000;
  border: 2px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
}

.gallery-admin-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-admin-thumb .thumb-tag {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(15, 23, 42, 0.8);
  color: #fbbf24;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
}

.gallery-admin-thumb .thumb-del-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(239, 68, 68, 0.9);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}

.gallery-admin-thumb .thumb-del-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.video-preview-frame {
  margin-top: 0.75rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0f172a;
  aspect-ratio: 16 / 9;
  max-height: 220px;
  display: none;
}

.video-preview-frame iframe,
.video-preview-frame video {
  width: 100%;
  height: 100%;
  border: none;
}

/* Responsive Portal Layout */
@media (max-width: 1024px) {
  .portal-sidebar {
    position: fixed;
    left: -260px;
  }
  .portal-sidebar.open {
    left: 0;
  }
}

