/* MiniAlert CSS Variables */
:root {
  --ma-bg: #ffffff;
  --ma-color: #333333;
  --ma-radius: 8px;
  --ma-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  --ma-overlay-bg: rgba(0, 0, 0, 0.5);
  --ma-primary: #007bff;
  --ma-danger: #dc3545;
  --ma-success: #28a745;
  --ma-warning: #ffc107;
  --ma-slide-duration: 0.5s;
}

/* Container */
.ma-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: block;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ma-container.ma-show {
  opacity: 1;
  visibility: visible;
}

/* Dialog */
.ma-dialog {
  background: var(--ma-bg);
  color: var(--ma-color);
  border-radius: var(--ma-radius);
  box-shadow: var(--ma-shadow);
  padding: 24px;
  min-width: 300px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  transition: transform var(--ma-slide-duration) ease;
  z-index: 0;
}

/* Current dialog (topmost) */
.ma-dialog.current-dialog {
  z-index: 3;
}

/* Dialog with custom background - remove default background */
.ma-dialog.ma-has-bg-html {
  background: transparent;
  box-shadow: none;
}

/* Custom Background HTML */
.ma-bg-html {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  border-radius: inherit;
  overflow: hidden;
}

.ma-bg-html > div {
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.ma-bg-html img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.ma-dialog.ma-fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  min-width: auto;
  border-radius: 0;
  margin: 0;
  padding: 20px;
}

.ma-container.ma-show .ma-dialog { transform: translate(-50%, -50%) scale(1); }

/* Slide-in positions */
.ma-dialog.ma-slide-center { transform: translate(-50%, -50%) scale(0.8); }
.ma-container.ma-show .ma-dialog.ma-slide-center { transform: translate(-50%, -50%) scale(1); }

.ma-dialog.ma-slide-right { transform: translate(calc(-50% + 40vw), -50%) scale(0.98); }
.ma-container.ma-show .ma-dialog.ma-slide-right { transform: translate(-50%, -50%) scale(1); }

.ma-dialog.ma-slide-left { transform: translate(calc(-50% - 40vw), -50%) scale(0.98); }
.ma-container.ma-show .ma-dialog.ma-slide-left { transform: translate(-50%, -50%) scale(1); }

.ma-dialog.ma-slide-top { transform: translate(-50%, calc(-50% - 40vh)) scale(0.98); }
.ma-container.ma-show .ma-dialog.ma-slide-top { transform: translate(-50%, -50%) scale(1); }

.ma-dialog.ma-slide-bottom { transform: translate(-50%, calc(-50% + 40vh)) scale(0.98); }
.ma-container.ma-show .ma-dialog.ma-slide-bottom { transform: translate(-50%, -50%) scale(1); }

/* Overlay placed above older dialogs and below the newest dialog */
.ma-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--ma-overlay-bg);
  z-index: 1;
}

/* Close Button */
.ma-close-btn {
  padding: 0;
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease, color 0.2s ease;
  z-index: 1;
}

.ma-close-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #333;
}

/* Header */
.ma-header {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
  line-height: 1.4;
}

/* Footer */
.ma-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

/* Content */
.ma-content {
  text-align: center;
  margin-bottom: 20px;
}

/* Content without buttons (for dialog type) */
.ma-dialog.ma-no-buttons .ma-content {
  margin-bottom: 0;
}

.ma-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.4;
}

.ma-text {
  font-size: 14px;
  line-height: 1.5;
}

/* Input */
.ma-input {
  width: calc(100% - 24px);
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  margin-top: 12px;
  outline: none;
  transition: border-color 0.2s ease;
}

.ma-input:focus {
  border-color: var(--ma-primary);
}

/* Buttons */
.ma-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.ma-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  min-width: 80px;
}

.ma-btn:focus {
  outline: 2px solid var(--ma-primary);
  outline-offset: 2px;
}

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

.ma-btn-primary:hover {
  background: #0056b3;
}

.ma-btn-secondary {
  background: #6c757d;
  color: white;
}

.ma-btn-secondary:hover {
  background: #545b62;
}

/* Toast */
.ma-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--ma-bg);
  color: var(--ma-color);
  padding: 12px 16px;
  border-radius: var(--ma-radius);
  box-shadow: var(--ma-shadow);
  z-index: 10000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  max-width: 300px;
}

.ma-toast.ma-show {
  transform: translateX(0);
}

.ma-toast.ma-success {
  border-left: 4px solid var(--ma-success);
}

.ma-toast.ma-error {
  border-left: 4px solid var(--ma-danger);
}

.ma-toast.ma-warning {
  border-left: 4px solid var(--ma-warning);
}

/* Loading */
.ma-loading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ma-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid var(--ma-primary);
  border-radius: 50%;
  animation: ma-spin 1s linear infinite;
}

@keyframes ma-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Loading Button State */
.ma-btn.ma-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0.7;
  cursor: not-allowed;
}

.ma-btn.ma-loading .ma-spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.ma-btn.ma-loading .ma-loading-text {
  font-size: 14px;
}

/* Custom Content Elements */
.ma-content [v-close],
.ma-content [v-cancel],
.ma-content [v-confirm] {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.ma-content [v-close]:hover,
.ma-content [v-cancel]:hover,
.ma-content [v-confirm]:hover {
  opacity: 0.8;
}

/* Fullscreen adjustments */
.ma-dialog.ma-fullscreen .ma-close-btn {
  top: 20px;
  right: 20px;
}

.ma-dialog.ma-fullscreen .ma-header {
  font-size: 24px;
  margin-bottom: 24px;
}

.ma-dialog.ma-fullscreen .ma-content {
  text-align: left;
  margin-bottom: 24px;
}

.ma-dialog.ma-fullscreen .ma-footer {
  margin-top: 24px;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .ma-container,
  .ma-dialog,
  .ma-toast,
  .ma-spinner {
    transition: none;
    animation: none;
  }
}