:root {
  --primary: #1e73be;       /* Brand Blue */
  --primary-dark: #135590;
  --primary-light: #e5f1fa;
  --primary-accent: #5384a3;
  --accent: #e27d5f;        /* Brand Coral / CTA */
  --accent-light: #fff3f0;
  --bg-dark: #111d28;
  --bg-light: #f8fbff;       /* Soft Baby Blue Background */
  --text-dark: #111d28;      /* Brand Ink */
  --text-muted: #5e6d7a;
  --white: #ffffff;
  
  --color-scheduled: #1e73be; 
  --color-reported: #d97706;  
  --color-approved: #2e7d32;  
  --color-rejected: #dc2626;  

  --radius-xl: 32px;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-sm: 0 2px 8px rgba(17, 29, 40, 0.04);
  --shadow-md: 0 6px 16px rgba(17, 29, 40, 0.06);
  --shadow-lg: 0 16px 32px rgba(17, 29, 40, 0.08);
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Arsenal', sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px 40px 20px;
}

/* Card Style */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1.5px solid rgba(30, 115, 190, 0.08);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  margin-bottom: 24px;
}

/* Brand Typography */
h1, h2, h3, h4 {
  font-family: 'Comfortaa', sans-serif;
  font-weight: 700;
  color: var(--text-dark);
}


/* Auth Page layout */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90vh;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  border: 1px solid #e2e8f0;
}

.brand-header {
  text-align: center;
  margin-bottom: 32px;
}

.brand-header h1 {
  font-size: 1.8rem;
  color: var(--primary);
  margin-top: 12px;
}

/* Form Styles */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-dark);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  color: var(--text-dark);
  background-color: var(--white);
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 4px rgba(83, 132, 163, 0.15);
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(44, 82, 112, 0.2);
}

.btn-primary:hover {
  background: #213e54;
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--accent); /* Brand Coral / Orange */
  color: var(--white);
  box-shadow: 0 4px 12px rgba(226, 125, 95, 0.2);
}

.btn-accent:hover {
  background: #d46f52;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary);
}

.btn-secondary:hover {
  background: #e1edf5;
}

.btn-danger {
  background: #fee2e2;
  color: var(--color-rejected);
}

.btn-danger:hover {
  background: #fca5a5;
}

.btn-block {
  width: 100%;
}

/* Main Top Header */
.main-header {
  background: var(--white);
  border-bottom: 1px solid #e2e8f0;
  padding: 14px 0;
  margin-bottom: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Navigation Tabs (Top Bar) */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 99px;
}

.nav-tab-btn {
  padding: 8px 18px;
  border-radius: 99px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-tab-btn:hover {
  color: var(--text-dark);
}

.nav-tab-btn.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.nav-tab-btn.has-notification {
  position: relative;
}

.nav-tab-btn.has-notification::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  border: 1.5px solid var(--white);
}


.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-badge {
  background: #f1f5f9;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge .dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
}

/* Stat Box Grid (4 Cards like screenshot) */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-box {
  background: var(--white);
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  font-size: 1.8rem;
  background: #f8fafc;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e2e8f0;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.1;
  margin-top: 2px;
}

/* Two-column Visit Sections */
.visits-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media(min-width: 900px) {
  .visits-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Item List Row (Mockup Style) */
.visit-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.visit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.visit-item:hover {
  background: var(--white);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.visit-item-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.visit-service-icon {
  font-size: 1.5rem;
  width: 42px;
  height: 42px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.visit-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.visit-family {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-dark);
}

.type-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: #e2e8f0;
  color: var(--text-muted);
}

.visit-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Status Badges */
.status-pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-naplanovano {
  background: #eff6ff;
  color: var(--color-scheduled);
  border: 1px solid #bfdbfe;
}

.status-vykazano {
  background: #fffbeb;
  color: var(--color-reported);
  border: 1px solid #fde68a;
}

.status-schvaleno {
  background: #f0fdf4;
  color: var(--color-approved);
  border: 1px solid #bbf7d0;
}

.status-zamitnuto {
  background: #fef2f2;
  color: var(--color-rejected);
  border: 1px solid #fecaca;
}

/* Modal Popup */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid #e2e8f0;
}

/* Dynamic Views */
.portal-view {
  display: none;
}

.portal-view.active {
  display: block;
}

/* Table styling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.table th, .table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

.table th {
  background-color: #f8fafc;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

/* Mobile Responsive Styles & Chat layout */
.chat-container {
  display: grid;
  grid-template-columns: 1fr;
  border: 1.5px solid rgba(30, 115, 190, 0.08);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--white);
  height: 500px;
}

@media (min-width: 768px) {
  .chat-container.admin-chat {
    grid-template-columns: 240px 1fr;
  }
}

.chat-sidebar {
  border-right: 1.5px solid rgba(30, 115, 190, 0.08);
  background: #f8fafc;
  overflow-y: auto;
  max-height: 100%;
}

.chat-user-item {
  padding: 14px 18px;
  cursor: pointer;
  border-bottom: 1px solid #edf2f7;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-user-item:hover, .chat-user-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

.chat-user-item .badge-unread {
  background: var(--accent);
  color: var(--white);
  border-radius: 50%;
  width: 8px;
  height: 8px;
}

.chat-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
}

.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fdfdfd;
}

.chat-msg {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.4;
}

.chat-msg.sent {
  align-self: flex-end;
  background: var(--primary);
  color: var(--white);
  border-bottom-right-radius: 2px;
}

.chat-msg.received {
  align-self: flex-start;
  background: #f1f5f9;
  color: var(--text-dark);
  border-bottom-left-radius: 2px;
}

.chat-msg-time {
  font-size: 0.72rem;
  opacity: 0.7;
  display: block;
  text-align: right;
  margin-top: 4px;
}

.chat-input-bar {
  display: flex;
  padding: 12px;
  border-top: 1px solid #e2e8f0;
  gap: 8px;
  background: #ffffff;
}

/* Responsive Overrides */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 10px;
  }
  
  .nav-tabs {
    overflow-x: auto;
    white-space: nowrap;
    display: flex;
    padding: 6px;
    border-radius: 12px;
    width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  
  .nav-tab-btn {
    display: inline-block;
    padding: 8px 14px;
    font-size: 0.85rem;
    flex-shrink: 0;
  }
  
  .user-info {
    justify-content: space-between;
    width: 100%;
  }

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

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

  .visit-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .visit-item > div:last-child {
    width: 100%;
    display: flex;
    justify-content: flex-end;
  }
  
  .hide-mobile {
    display: none !important;
  }
}

/* Print Styles */
@media print {
  .main-header, .btn, .filter-bar, .nav-tabs {
    display: none !important;
  }
  .card {
    box-shadow: none;
    border: none;
    padding: 0;
  }
}
