/* Modals Component */
/* Skupina Hexagon SVR Application */

/* === Modal Overlay === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal-backdrop);
  animation: fadeIn 0.3s ease;
  backdrop-filter: blur(2px);
}

/* === Modal Container === */
.modal {
  background-color: var(--color-bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow: auto;
  animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: var(--z-modal);
  position: relative;
  margin: auto;
}

/* === Modal Sizes === */
.modal-sm {
  max-width: 400px;
}

.modal-lg {
  max-width: 800px;
}

.modal-xl {
  max-width: 1140px;
}

.modal-fullscreen {
  max-width: 100%;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  margin: 0;
}

/* === Modal Header === */
.modal-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
}

.modal-header-gradient {
  background: var(--gradient-primary);
  color: white;
}

.modal-header-gradient .modal-title {
  color: white;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: var(--font-medium);
  color: var(--color-primary);
  margin: 0;
}

/* === Modal Close Button === */
.modal-close {
  background: none;
  border: none;
  font-size: var(--text-2xl);
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.modal-close:hover {
  background-color: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.modal-header-gradient .modal-close {
  color: white;
}

.modal-header-gradient .modal-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* === Modal Body === */
.modal-body {
  padding: var(--spacing-lg);
  overflow-y: auto;
}

/* === Modal Footer === */
.modal-footer {
  padding: var(--spacing-lg);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.modal-footer-center {
  justify-content: center;
}

.modal-footer-between {
  justify-content: space-between;
}

/* === Confirmation Modal === */
.modal-confirm .modal-header {
  background-color: var(--color-warning);
  color: white;
}

.modal-confirm .modal-title {
  color: white;
}

.modal-danger .modal-header {
  background-color: var(--color-error);
  color: white;
}

.modal-danger .modal-title {
  color: white;
}

.modal-success .modal-header {
  background-color: var(--color-success);
  color: white;
}

.modal-success .modal-title {
  color: white;
}

/* === Modal Icon === */
.modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--spacing-md);
  font-size: 2rem;
}

.modal-icon-success {
  background-color: rgba(39, 174, 96, 0.1);
  color: var(--color-success);
}

.modal-icon-error {
  background-color: rgba(231, 76, 60, 0.1);
  color: var(--color-error);
}

.modal-icon-warning {
  background-color: rgba(243, 156, 18, 0.1);
  color: var(--color-warning);
}

.modal-icon-info {
  background-color: rgba(52, 152, 219, 0.1);
  color: var(--color-info);
}

/* === Modal Backdrop Click to Close === */
.modal-overlay[data-dismiss="true"] {
  cursor: pointer;
}

.modal-overlay[data-dismiss="true"] .modal {
  cursor: default;
}

/* === Modal Animations === */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* === Drawer/Slide Modal === */
.modal-drawer {
  animation: slideInRight 0.3s ease;
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  max-height: 100vh;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  margin: 0;
}

.modal-drawer-left {
  animation: slideInLeft 0.3s ease;
  left: 0;
  right: auto;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

/* === Scrollable Modal Body === */
.modal-scrollable .modal-body {
  max-height: 60vh;
  overflow-y: auto;
}

/* === Modal with Tabs === */
.modal-tabs {
  display: flex;
  gap: var(--spacing-md);
  border-bottom: 2px solid var(--color-border);
  margin-bottom: var(--spacing-md);
}

.modal-tab {
  padding: var(--spacing-sm) var(--spacing-md);
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

.modal-tab.active {
  color: var(--color-accent);
  font-weight: var(--font-medium);
}

.modal-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
}