/* ============================================
   site.css — shared layout utilities
   NOTE: site-theme-dark.css loads AFTER this file and supplies themed
   colors, borders, and fonts. Rules here should be LAYOUT-ONLY
   (responsive sizing, animations, specific component chrome). Do NOT
   hardcode colors here — use var(--cs-*) with fallbacks so the Theme
   Editor can retarget them.
   ============================================ */

/* Base typography - mobile first */
html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Layout */
html {
  position: relative;
  min-height: 100%;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Mobile-optimized card hover (layout only — colors themed in site-theme-dark.css) */
.card {
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
}

/* Responsive navbar */
@media (max-width: 991.98px) {
  .navbar-nav {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .navbar-nav .nav-link {
    padding: 0.5rem 0;
  }
}

/* Button shape (color + radius themed in site-theme-dark.css) */
.btn {
  font-weight: 500;
  transition: all 0.2s;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
}

/* Mobile touch targets */
@media (max-width: 767.98px) {
  .btn {
    min-height: 44px;
    padding: 0.5rem 1rem;
  }

  .form-control, .form-select {
    min-height: 44px;
  }

  .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* Hero primary background (Bootstrap .bg-primary override).
   Uses theme gradient endpoints so it retargets with the brand. */
.bg-primary {
  background: linear-gradient(135deg,
    var(--cs-modal-header-bg-start, var(--cs-purple, #667eea)) 0%,
    var(--cs-modal-header-bg-end, var(--cs-blue, #764ba2)) 100%) !important;
}

/* Feature icons */
.feature-icon {
  font-size: 2rem;
}

/* Stats cards on dashboard */
.card-body h3 {
  font-size: 2rem;
  font-weight: 700;
}

/* Mobile spacing adjustments */
@media (max-width: 767.98px) {
  .py-5 {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }

  .display-4 {
    font-size: 2rem;
  }

  .display-5 {
    font-size: 1.75rem;
  }
}

/* Alert animations */
.alert {
  animation: slideDown 0.3s ease-out;
}

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

/* Loading states */
.btn.loading {
  position: relative;
  color: transparent !important;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 1rem;
  height: 1rem;
  top: 50%;
  left: 50%;
  margin-left: -0.5rem;
  margin-top: -0.5rem;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.6s linear infinite;
}

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

/* Responsive tables */
@media (max-width: 767.98px) {
  .table-responsive {
    font-size: 0.875rem;
  }
}

/* Badge improvements */
.badge {
  font-weight: 500;
  padding: 0.35em 0.65em;
}

/* List group improvements */
.list-group-item {
  border-left: none;
  border-right: none;
}

.list-group-item:first-child {
  border-top: none;
}

.list-group-item:last-child {
  border-bottom: none;
}

/* Accessibility improvements */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Camera Schedule Grid ===== */
.schedule-card:hover {
    transform: none !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.schedule-grid {
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
}

.schedule-grid .schedule-time-col {
    width: 70px;
    min-width: 70px;
}

.schedule-grid .schedule-time-label {
    font-size: 0.7rem;
    color: var(--cs-text-secondary, #6c757d);
    white-space: nowrap;
    padding: 1px 4px !important;
    vertical-align: middle;
    border-right: 2px solid var(--cs-border, #dee2e6);
}

.schedule-grid .schedule-day-header {
    font-size: 0.8rem;
    padding: 4px 2px !important;
}

.schedule-grid .schedule-cell {
    padding: 0 !important;
    height: 6px;
    min-width: 28px;
    cursor: pointer;
    transition: background-color 0.05s;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* schedule-on / schedule-off use semantic success/danger theme colors */
.schedule-grid .schedule-cell.schedule-on {
    background-color: var(--cs-alert-success, #28a745);
}

.schedule-grid .schedule-cell.schedule-off {
    background-color: var(--cs-alert-danger, #f8d7da);
    opacity: 0.5;
}

.schedule-grid .schedule-cell:hover {
    outline: 2px solid var(--cs-blue, #0d6efd);
    outline-offset: -2px;
    z-index: 1;
    position: relative;
}

.schedule-grid .schedule-time-label.schedule-highlight {
    background-color: var(--cs-alert-warning, #fff3cd) !important;
    color: var(--cs-dark-bg, #664d03) !important;
    font-weight: 600;
}

.schedule-grid .schedule-day-header.schedule-highlight {
    background-color: var(--cs-alert-warning, #fff3cd) !important;
    color: var(--cs-dark-bg, #664d03) !important;
}

.schedule-grid tr[data-hour-boundary] td {
    border-top: 1px solid var(--cs-border, #adb5bd);
}

.schedule-tabs .nav-link {
    font-size: 0.85rem;
    padding: 0.3rem 0.75rem;
}

.schedule-tabs .nav-link.active {
    font-weight: 600;
}

/* ========================================
   Help Tooltip (reusable question-mark icon)
   ======================================== */
.help-tooltip-container {
    position: relative;
    display: inline-block;
}

.help-tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg,
      var(--cs-alert-info, #17a2b8) 0%,
      var(--cs-blue, #138496) 100%);
    color: #ffffff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    cursor: help;
    margin-left: 6px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    vertical-align: middle;
}

.help-tooltip-trigger:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 10px var(--cs-focus-ring, rgba(23, 162, 184, 0.4));
}

.help-tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 1050;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    background: linear-gradient(135deg,
      var(--cs-card-bg, #1a1a2e) 0%,
      var(--cs-dark-bg, #16213e) 100%);
    color: var(--cs-text-primary, #ffffff);
    padding: 14px;
    border-radius: 10px;
    font-size: 0.85em;
    line-height: 1.5;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    transition: opacity 0.25s, visibility 0.25s;
    text-align: left;
}

.help-tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--cs-dark-bg, #16213e);
}

.help-tooltip-container:hover .help-tooltip-content {
    visibility: visible;
    opacity: 1;
}

.help-tooltip-content .tooltip-title {
    font-weight: 600;
    color: var(--cs-yellow, #ffd700);
    margin-bottom: 8px;
    font-size: 1.05em;
}

.help-tooltip-content .tooltip-section {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.help-tooltip-content .tooltip-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.help-tooltip-content .tooltip-label {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.help-tooltip-content .tooltip-label.label-info {
    background: var(--cs-alert-info, #17a2b8);
    color: #ffffff;
}

.help-tooltip-content .tooltip-label.label-advanced {
    background: var(--cs-alert-warning, #ffc107);
    color: var(--cs-dark-bg, #212529);
}

.help-tooltip-content .tooltip-tip {
    background: rgba(23, 162, 184, 0.2);
    border-left: 3px solid var(--cs-alert-info, #17a2b8);
    padding: 6px 10px;
    border-radius: 0 5px 5px 0;
    font-size: 0.9em;
    margin-top: 8px;
}

@media (max-width: 768px) {
    .help-tooltip-content {
        width: 260px;
        left: 0;
        transform: translateX(0);
    }
    .help-tooltip-content::after {
        left: 15px;
        transform: translateX(0);
    }
}

/* Modal positioning fix for mobile (PT-00029)
   On small screens, show modals at the top of the viewport instead of
   vertically centered, so they are always visible and not hidden off-screen. */
@media (max-width: 767.98px) {
  .modal-dialog.modal-dialog-centered {
    align-items: flex-start;
  }
}

/* ===== Cookie Consent Banner ===== */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1060;
    background: linear-gradient(135deg,
      var(--cs-card-bg, #1a1a2e) 0%,
      var(--cs-dark-bg, #16213e) 100%);
    color: var(--cs-text-primary, #f8f9fa);
    padding: 1rem 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}

.cookie-consent-banner.cookie-consent-visible {
    transform: translateY(0);
}

.cookie-consent-banner.cookie-consent-hiding {
    transform: translateY(100%);
    transition: transform 0.3s ease-in;
}

.cookie-consent-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.cookie-consent-text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.5;
}

.cookie-consent-link {
    color: var(--cs-link-color, #86b7fe);
    text-decoration: underline;
    font-weight: 500;
}

.cookie-consent-link:hover {
    color: var(--cs-link-hover-color, #b6d4fe);
}

.cookie-consent-buttons {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.cookie-consent-btn {
    min-width: 100px;
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .cookie-consent-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .cookie-consent-buttons {
        width: 100%;
        justify-content: center;
    }

    .cookie-consent-btn {
        flex: 1;
        min-width: 0;
    }
}
