/* 
   GWiZ Software Solutions - tenant.css
   Tenant Dashboard specific layouts, tables, and auth views.
*/

.tenant-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Ambient glow orbs */
.glow-orb {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  pointer-events: none;
}
.orb-1 {
  top: -10%;
  left: -10%;
  background: rgba(139, 92, 246, 0.12);
}
.orb-2 {
  bottom: -10%;
  right: -10%;
  background: rgba(6, 182, 212, 0.12);
}

.tenant-header {
  border-bottom: 1px solid var(--border-color);
  background: rgba(8, 11, 17, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1.2rem 2rem;
}

.tenant-main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 2rem;
}

/* Authentication Screen */
.auth-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.auth-card {
  max-width: 480px;
  width: 100%;
  padding: 3rem 2.5rem;
  text-align: center;
}

.auth-shield {
  font-size: 3.5rem;
  margin-bottom: 1.5rem;
  display: inline-block;
  animation: float 6s ease-in-out infinite;
}

.auth-header-card h2 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  background: linear-gradient(135deg, #ffffff 30%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-header-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 2.2rem;
}

.auth-error-msg {
  background: rgba(234, 67, 53, 0.1);
  border: 1px solid rgba(234, 67, 53, 0.3);
  color: #fca5a5;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

/* Dashboard Layout */
.dashboard-section {
  animation: fadeIn 0.5s ease-out;
}

/* Welcome Ribbon */
.welcome-ribbon {
  padding: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1.5rem;
  border-left: 3px solid var(--accent-cyan);
}
.welcome-ribbon h2 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  background: linear-gradient(135deg, #ffffff 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.welcome-ribbon p {
  color: var(--text-muted);
  font-size: 0.95rem;
}
.sync-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1rem;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
}

/* Metric Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-left: 3px solid var(--accent-cyan);
}
.stat-card.pipeline-stat {
  border-left-color: var(--accent-purple);
}
.stat-card.win-stat {
  border-left-color: var(--success);
}
.stat-card.sla-stat {
  border-left-color: var(--accent-blue);
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

/* Records Log Card */
.records-card {
  padding: 2rem;
}

.records-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.records-header h3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.records-header p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.btn-refresh {
  padding: 0.6rem 1.2rem;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid var(--accent-cyan);
  color: var(--text-main);
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-refresh:hover {
  background: var(--accent-cyan);
  color: #080b11;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.btn-logout {
  padding: 0.5rem 1.1rem;
  background: transparent;
  border: 1px solid rgba(234, 67, 53, 0.4);
  color: #f87171;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-logout:hover {
  background: rgba(234, 67, 53, 0.15);
  border-color: rgba(234, 67, 53, 0.8);
}

/* Data Table Styles */
.table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: rgba(8, 11, 17, 0.4);
}

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

.leads-table th, 
.leads-table td {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.leads-table th {
  background: rgba(15, 20, 32, 0.8);
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-main);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

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

.leads-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.table-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 4rem !important;
  font-style: italic;
}

.leads-table .date-col {
  white-space: nowrap;
  font-family: monospace;
  color: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

@media (max-width: 992px) {
  .tenant-main {
    padding: 1.5rem 1rem;
  }
  .records-card {
    padding: 1.2rem;
  }
  .leads-table th, 
  .leads-table td {
    padding: 1rem;
  }
}

/* Modal styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 11, 17, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.modal-card {
  max-width: 480px;
  width: 90%;
  padding: 2.5rem;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-color);
  border-left: 3px solid var(--accent-cyan);
}

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

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  transition: var(--transition-smooth);
}

.btn-close:hover {
  color: var(--text-main);
  transform: scale(1.1);
}

.auth-success-msg {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.auth-link:hover {
  text-decoration: underline !important;
  color: #22d3ee !important;
}

/* Accessibility Focus Indicator */
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
}

/* Learning Vault Grid & Cards */
.learning-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.learning-item {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.01);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.learning-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.learning-item.item-purple { border-left: 3px solid var(--accent-purple); }
.learning-item.item-cyan { border-left: 3px solid var(--accent-cyan); }
.learning-item.item-green { border-left: 3px solid var(--success); }
.learning-item.item-blue { border-left: 3px solid var(--accent-blue); }

.learning-icon {
  font-size: 1.5rem;
  margin-bottom: 0.8rem;
  display: block;
}

.learning-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.learning-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 1rem;
}

.learning-action {
  text-align: center;
  text-decoration: none;
  display: block;
  font-size: 0.8rem;
  padding: 0.5rem;
  width: 100%;
}

/* Document Modal Viewer specific styles */
.doc-modal-card {
  max-width: 900px !important;
  width: 95%;
  height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border-left: 3px solid var(--accent-cyan);
}

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

.doc-modal-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--text-main);
  margin: 0;
}

.doc-modal-body {
  flex-grow: 1;
  position: relative;
  width: 100%;
  height: 100%;
}

.doc-modal-iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
}

@media (max-width: 768px) {
  .doc-modal-card {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    padding: 1rem;
    border-left: none;
    border-top: 3px solid var(--accent-cyan);
  }
}

@media (max-width: 480px) {
  .tenant-header {
    padding: 0.8rem 1rem !important;
  }
  .logo {
    font-size: 1.1rem !important;
  }
  .btn-logout {
    padding: 0.4rem 0.8rem !important;
    font-size: 0.75rem !important;
  }
  .auth-card {
    padding: 2rem 1.25rem !important;
  }
  .auth-header-card h2 {
    font-size: 1.35rem !important;
    margin-bottom: 0.4rem !important;
  }
  .auth-header-card p {
    font-size: 0.78rem !important;
    line-height: 1.4 !important;
  }
  .records-header h3 {
    font-size: 1.25rem !important;
  }
  .records-header p {
    font-size: 0.8rem !important;
  }
  .leads-table th {
    font-size: 0.7rem !important;
    padding: 0.8rem !important;
  }
  .leads-table td {
    font-size: 0.8rem !important;
    padding: 0.8rem !important;
  }
  .learning-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .learning-item {
    padding: 1.25rem 1rem !important;
  }
  .learning-item h4 {
    font-size: 0.95rem !important;
  }
  .learning-item p {
    font-size: 0.75rem !important;
  }
}
