/*
 * Primaris Employee Portal Styles
 * Based on Primaris Brand Guidelines v2.0
 */

/* ==================== */
/* PRIMARIS COLORS      */
/* ==================== */
:root {
  /* Primary Palette */
  --primaris-red: #E12727;
  --dark-gray: #4B4F55;
  --medium-gray: #787A80;
  --light-gray-1: #EDEDED;
  --light-gray-2: #C9C9CC;
  --primaris-blue: #6B91BA;
  --primaris-tan: #BFB59E;

  /* Secondary Palette */
  --primaris-teal: #2E9EA6;
  --primaris-green: #9EB03D;
  --primaris-gold: #E5A64A;
  --primaris-purple: #A12966;

  /* Utility Colors */
  --white: #FFFFFF;
  --black: #000000;
  --off-white: #FFFAFF;

  /* Status Colors */
  --status-new: #6B91BA;
  --status-progress: #E5A64A;
  --status-resolved: #9EB03D;
  --status-closed: #787A80;
  --status-default: #C9C9CC;
}

/* ==================== */
/* RESET & BASE         */
/* ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--dark-gray);
  background-color: var(--light-gray-1);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Segoe UI Semibold', 'Nunito Sans', sans-serif;
  color: var(--dark-gray);
  line-height: 1.3;
}

h1 { font-size: 2rem; font-weight: 600; }
h2 { font-size: 1.75rem; font-weight: 600; }
h3 { font-size: 1.5rem; font-weight: 600; }
h4 { font-size: 1.25rem; font-weight: 600; }

a {
  color: var(--primaris-red);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primaris-blue);
  text-decoration: underline;
}

/* ==================== */
/* LOGIN PAGE           */
/* ==================== */
.login-page {
  background: linear-gradient(135deg, var(--primaris-blue) 0%, var(--primaris-teal) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-container {
  width: 100%;
  max-width: 480px;
}

.login-box {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.login-header {
  background: var(--dark-gray);
  color: var(--white);
  padding: 2.5rem 2rem;
  text-align: center;
}

.login-logo {
  max-width: 180px;
  height: auto;
  margin-bottom: 1rem;
}

.login-header h1 {
  color: var(--white);
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
}

.tagline {
  color: var(--light-gray-1);
  font-size: 0.95rem;
  font-style: italic;
}

.login-content {
  padding: 2.5rem 2rem;
}

.login-content h2 {
  margin-bottom: 0.5rem;
  color: var(--dark-gray);
}

.login-content p {
  color: var(--medium-gray);
  margin-bottom: 2rem;
}

.login-footer {
  background: var(--light-gray-1);
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--medium-gray);
}

/* ==================== */
/* HEADER               */
/* ==================== */
.portal-header {
  background: var(--white);
  border-bottom: 3px solid var(--primaris-red);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-logo {
  height: 45px;
  width: auto;
}

.portal-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--dark-gray);
  margin: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.user-welcome {
  color: var(--medium-gray);
  font-size: 0.95rem;
}

.user-welcome strong {
  color: var(--dark-gray);
}

/* ==================== */
/* MAIN CONTENT         */
/* ==================== */
.portal-main {
  flex: 1;
  padding: 2rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.content-wrapper {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 2rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--light-gray-1);
}

.page-header h2 {
  color: var(--dark-gray);
  margin: 0;
}

/* ==================== */
/* BUTTONS              */
/* ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primaris-red);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background: #c11f1f;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(225, 39, 39, 0.3);
}

.btn-secondary {
  background: var(--dark-gray);
  color: var(--white);
}

.btn-secondary:hover:not(:disabled) {
  background: #3a3d42;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(75, 79, 85, 0.3);
}

.btn-large {
  padding: 0.875rem 2rem;
  font-size: 1.05rem;
  width: 100%;
  justify-content: center;
}

.icon {
  font-size: 1.2rem;
  line-height: 1;
}

/* ==================== */
/* MESSAGES             */
/* ==================== */
.loading-message,
.error-message,
.info-message {
  padding: 1.25rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.loading-message {
  background: var(--light-gray-1);
  color: var(--medium-gray);
  text-align: center;
}

.error-message {
  background: #FEE;
  border-left: 4px solid var(--primaris-red);
  color: #C00;
}

.info-message {
  background: #FFF9E6;
  border-left: 4px solid var(--primaris-gold);
  color: var(--dark-gray);
  text-align: center;
  padding: 2rem;
}

.info-icon {
  font-size: 3rem;
  color: var(--primaris-gold);
  margin-bottom: 1rem;
}

.info-message h3 {
  color: var(--dark-gray);
  margin-bottom: 0.5rem;
}

.info-message p {
  color: var(--medium-gray);
  margin-bottom: 0.5rem;
}

/* ==================== */
/* FILTERS              */
/* ==================== */
.filters-section {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--light-gray-1);
  border-radius: 6px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  font-weight: 600;
  color: var(--dark-gray);
  font-size: 0.9rem;
}

.filter-select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--light-gray-2);
  border-radius: 4px;
  font-size: 0.9rem;
  background: var(--white);
  color: var(--dark-gray);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.filter-select:hover {
  border-color: var(--primaris-blue);
}

.filter-select:focus {
  outline: none;
  border-color: var(--primaris-red);
  box-shadow: 0 0 0 3px rgba(225, 39, 39, 0.1);
}

.filter-stats {
  margin-left: auto;
  font-weight: 600;
  color: var(--medium-gray);
  font-size: 0.9rem;
}

/* ==================== */
/* TABLE                */
/* ==================== */
.table-container {
  overflow-x: auto;
}

.tickets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.tickets-table thead {
  background: var(--dark-gray);
  color: var(--white);
}

.tickets-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tickets-table tbody tr {
  border-bottom: 1px solid var(--light-gray-1);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.tickets-table tbody tr:hover {
  background: var(--off-white);
}

.tickets-table td {
  padding: 1rem;
}

.ticket-id {
  font-weight: 600;
  color: var(--primaris-blue);
}

.ticket-subject {
  color: var(--dark-gray);
  font-weight: 500;
}

.ticket-date {
  color: var(--medium-gray);
  font-size: 0.875rem;
}

.ticket-date-small {
  display: block;
  color: var(--light-gray-2);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.ticket-owner {
  color: var(--medium-gray);
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-new {
  background: #E3EFF9;
  color: var(--status-new);
}

.status-progress {
  background: #FEF5E6;
  color: #C78627;
}

.status-resolved {
  background: #EDF5E3;
  color: #6F8C2B;
}

.status-closed {
  background: var(--light-gray-1);
  color: var(--medium-gray);
}

.status-default {
  background: var(--light-gray-1);
  color: var(--medium-gray);
}

/* ==================== */
/* EMPTY STATE          */
/* ==================== */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--medium-gray);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h3 {
  color: var(--dark-gray);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--medium-gray);
}

/* ==================== */
/* MODAL                */
/* ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  background: var(--white);
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  margin: 2rem auto;
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  background: var(--dark-gray);
  color: var(--white);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  color: var(--white);
  margin: 0;
  font-size: 1.5rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.modal-loading {
  text-align: center;
  padding: 3rem;
  color: var(--medium-gray);
}

.modal-footer {
  border-top: 1px solid var(--light-gray-1);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* ==================== */
/* TICKET DETAILS       */
/* ==================== */
.detail-section {
  margin-bottom: 2rem;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-section h3 {
  color: var(--dark-gray);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primaris-red);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
}

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

.detail-item label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--medium-gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-item span {
  color: var(--dark-gray);
  font-size: 0.95rem;
}

/* ==================== */
/* ACTIVITIES           */
/* ==================== */
.activities-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.activity-item {
  background: var(--light-gray-1);
  padding: 1rem;
  border-radius: 6px;
  border-left: 4px solid var(--primaris-blue);
}

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

.activity-type {
  font-weight: 600;
  color: var(--dark-gray);
}

.activity-date {
  font-size: 0.85rem;
  color: var(--medium-gray);
}

.activity-subject {
  font-weight: 500;
  color: var(--dark-gray);
  margin-bottom: 0.25rem;
}

.activity-description {
  color: var(--medium-gray);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Rich text formatting within activity descriptions */
.activity-description p {
  margin: 0.5rem 0;
}

.activity-description p:first-child {
  margin-top: 0;
}

.activity-description p:last-child {
  margin-bottom: 0;
}

.activity-description strong,
.activity-description b {
  font-weight: 600;
  color: var(--dark-gray);
}

.activity-description em,
.activity-description i {
  font-style: italic;
}

.activity-description u {
  text-decoration: underline;
}

.activity-description a {
  color: var(--primaris-blue);
  text-decoration: none;
}

.activity-description a:hover {
  text-decoration: underline;
}

.activity-description ul,
.activity-description ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.activity-description li {
  margin: 0.25rem 0;
}

.activity-description blockquote {
  border-left: 3px solid var(--primaris-blue);
  padding-left: 1rem;
  margin: 0.5rem 0;
  color: var(--medium-gray);
  font-style: italic;
}

.activity-description pre,
.activity-description code {
  background: var(--light-gray-2);
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
}

.activity-description pre {
  padding: 0.75rem;
  overflow-x: auto;
}

.activity-description table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5rem 0;
}

.activity-description th,
.activity-description td {
  border: 1px solid var(--light-gray-2);
  padding: 0.5rem;
  text-align: left;
}

.activity-description th {
  background: var(--light-gray-1);
  font-weight: 600;
}

.activity-description h1,
.activity-description h2,
.activity-description h3,
.activity-description h4,
.activity-description h5,
.activity-description h6 {
  margin: 0.75rem 0 0.5rem 0;
  color: var(--dark-gray);
}

.activity-description h1 { font-size: 1.5rem; }
.activity-description h2 { font-size: 1.3rem; }
.activity-description h3 { font-size: 1.1rem; }
.activity-description h4 { font-size: 1rem; }
.activity-description h5 { font-size: 0.95rem; }
.activity-description h6 { font-size: 0.9rem; }

.no-activities {
  text-align: center;
  padding: 2rem;
  color: var(--medium-gray);
  background: var(--light-gray-1);
  border-radius: 6px;
}

/* ==================== */
/* FOOTER               */
/* ==================== */
.portal-footer {
  background: var(--dark-gray);
  color: var(--light-gray-1);
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.875rem;
  margin-top: auto;
}

.portal-footer a {
  color: var(--white);
  text-decoration: underline;
}

.portal-footer a:hover {
  color: var(--primaris-red);
}

/* ==================== */
/* RESPONSIVE           */
/* ==================== */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .header-left {
    flex-direction: column;
    gap: 0.5rem;
  }

  .header-right {
    flex-direction: column;
    gap: 0.75rem;
  }

  .portal-main {
    padding: 1rem;
  }

  .content-wrapper {
    padding: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .filters-section {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-stats {
    margin-left: 0;
    text-align: center;
  }

  .tickets-table {
    font-size: 0.85rem;
  }

  .tickets-table th,
  .tickets-table td {
    padding: 0.75rem 0.5rem;
  }

  .modal-content {
    width: 95%;
    margin: 1rem auto;
    max-height: 95vh;
  }

  .modal-body {
    padding: 1rem;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .login-page {
    padding: 1rem;
  }

  .login-content {
    padding: 1.5rem 1rem;
  }

  .portal-title {
    font-size: 1.25rem;
  }

  .tickets-table th:nth-child(3),
  .tickets-table th:nth-child(4),
  .tickets-table td:nth-child(3),
  .tickets-table td:nth-child(4) {
    display: none;
  }
}

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

.tickets-table tbody tr {
  animation: fadeIn 0.3s ease;
}

/* ==================== */
/* FORM COMPONENTS      */
/* ==================== */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--dark-gray);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--light-gray-2);
  border-radius: 4px;
  font-size: 0.95rem;
  background: var(--white);
  color: var(--dark-gray);
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:hover,
.form-textarea:hover,
.form-select:hover {
  border-color: var(--primaris-blue);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primaris-red);
  box-shadow: 0 0 0 3px rgba(225, 39, 39, 0.1);
}

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1em;
  padding-right: 2.5rem;
}

.select-wrapper {
  position: relative;
}

.field-loading {
  position: absolute;
  top: 50%;
  right: 2.5rem;
  transform: translateY(-50%);
  pointer-events: none;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--light-gray-2);
  border-top-color: var(--primaris-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.required {
  color: var(--primaris-red);
  font-weight: 600;
  margin-left: 2px;
}

.form-hint {
  display: block;
  font-size: 0.85rem;
  color: var(--medium-gray);
  margin-top: 0.25rem;
}

.form-error {
  display: block;
  font-size: 0.85rem;
  color: var(--primaris-red);
  margin-top: 0.25rem;
  font-weight: 500;
}

/* ==================== */
/* SUCCESS MESSAGE      */
/* ==================== */
.success-message {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: var(--primaris-green);
  color: var(--white);
  border-radius: 6px;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(158, 176, 61, 0.3);
  animation: slideDown 0.3s ease;
}

.success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  font-weight: 700;
  font-size: 1.1rem;
}

.message-close {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.message-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.success-message.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ==================== */
/* BUTTON VARIATIONS    */
/* ==================== */
.btn-large {
  padding: 0.875rem 2rem;
  font-size: 1.05rem;
  min-width: 150px;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

/* ==================== */
/* UTILITIES            */
/* ==================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
