/* Base typography - mobile first */
html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Focus states */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* Layout */
html {
  position: relative;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Mobile-optimized cards */
.card {
  border-radius: 0.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* 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 improvements */
.btn {
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
}

/* Form controls */
.form-control, .form-select {
  border-radius: 0.375rem;
  border: 1px solid #dee2e6;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* 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 section gradient */
.bg-primary {
  background: linear-gradient(135deg, #667eea 0%, #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: #6c757d;
    white-space: nowrap;
    padding: 1px 4px !important;
    vertical-align: middle;
    border-right: 2px solid #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-grid .schedule-cell.schedule-on {
    background-color: #28a745;
}

.schedule-grid .schedule-cell.schedule-off {
    background-color: #f8d7da;
}

.schedule-grid .schedule-cell:hover {
    outline: 2px solid #0d6efd;
    outline-offset: -2px;
    z-index: 1;
    position: relative;
}

.schedule-grid .schedule-time-label.schedule-highlight {
    background-color: #fff3cd !important;
    color: #664d03 !important;
    font-weight: 600;
}

.schedule-grid .schedule-day-header.schedule-highlight {
    background-color: #fff3cd !important;
    color: #664d03 !important;
}

.schedule-grid tr[data-hour-boundary] td {
    border-top: 1px solid #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, #17a2b8 0%, #138496 100%);
    color: white;
    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 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, #1a1a2e 0%, #16213e 100%);
    color: white;
    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: #16213e;
}

.help-tooltip-container:hover .help-tooltip-content {
    visibility: visible;
    opacity: 1;
}

.help-tooltip-content .tooltip-title {
    font-weight: 600;
    color: #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: #17a2b8;
    color: white;
}

.help-tooltip-content .tooltip-label.label-advanced {
    background: #ffc107;
    color: #212529;
}

.help-tooltip-content .tooltip-tip {
    background: rgba(23, 162, 184, 0.2);
    border-left: 3px solid #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;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  /* Add dark mode styles here if desired */
}

/* ===== Cookie Consent Banner ===== */
.cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1060;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #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: #86b7fe;
    text-decoration: underline;
    font-weight: 500;
}

.cookie-consent-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;
    }
}