/**
 * Anadolu Üniversitesi Kütüphane - Utilities
 * Quick actions panel, back to top, floating elements
 */

/* =====================================================
   QUICK ACTIONS PANEL
===================================================== */
.quick-actions-panel {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1100; /* Erişilebilirlik butonunun üstünde olmalı (accessibility: 1000) */
}

.quick-actions-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: white;
  color: var(--primary-color);
  border: 2px solid white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-10);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  position: relative;
}

.quick-actions-btn i {
  transition: color 0.3s ease;
  position: relative;
  z-index: 1;
}

.quick-actions-btn:hover {
  background-color: white;
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.quick-actions-btn:hover i {
  color: var(--accent-color);
}

/* Footer üzerinde iken */
.quick-actions-btn.on-footer {
  border-color: white;
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.5);
}

.quick-actions-menu {
  position: absolute;
  bottom: 65px;
  left: 0;
  min-width: 320px;
  max-height: calc(100vh - 150px); /* Ekran yüksekliğinden header+footer alanı çıkar */
  background: white;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.quick-actions-panel.active .quick-actions-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.quick-actions-header {
  padding: 1rem 1.25rem;
  border-bottom: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #2563b5 0%, #1e4a8a 100%);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  flex-shrink: 0; /* Header'ın scroll ile küçülmemesi için */
}

.quick-actions-header h5 {
  margin: 0;
  font-size: var(--fs-7);
  font-weight: 600;
  color: white;
}

.quick-actions-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  color: white;
  opacity: 0.9;
  transition: all 0.3s ease;
}

.quick-actions-close:hover {
  transform: rotate(90deg);
  opacity: 1;
}

.quick-actions-content {
  padding: 0.5rem;
  overflow-y: auto; /* İçerik taşarsa scroll */
  flex: 1; /* Kalan alanı kullan */
}

/* Scroll bar styling */
.quick-actions-content::-webkit-scrollbar {
  width: 6px;
}

.quick-actions-content::-webkit-scrollbar-track {
  background: transparent;
}

.quick-actions-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.quick-actions-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.quick-action-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-color);
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid #e5e7eb; /* Soluk gri border */
  background: white;
  width: 100%;
  text-align: left;
}

.quick-action-item:hover {
  background-color: #f0f4ff;
  border-color: var(--primary-color);
  transform: translateX(3px);
}

.quick-action-item i {
  font-size: 1.5rem;
  color: var(--primary-color);
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.quick-action-info {
  flex: 1;
}

.quick-action-info h6 {
  margin: 0;
  font-size: var(--fs-6);
  font-weight: 600;
  color: var(--text-color);
}

.quick-action-info p {
  display: none;
}

.quick-action-item .shortcut {
  display: none;
}

/* Quick Action Toast */
.quick-action-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: var(--success-color, #10b981);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 10000;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
}

.quick-action-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.quick-action-toast i {
  font-size: 1.25rem;
}

.quick-action-toast span {
  font-size: var(--fs-6);
  font-weight: 500;
}

/* =====================================================
   FLOATING NOTIFICATIONS
===================================================== */
.notification-float {
  position: fixed;
  top: 80px;
  right: 20px;
  max-width: 350px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  box-shadow: var(--shadow-md);
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* =====================================================
   DARK THEME
===================================================== */
html[data-theme="dark"] .quick-actions-menu {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
}

html[data-theme="dark"] .quick-action-item {
  background-color: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.1); /* Soluk border dark mode'da */
}

html[data-theme="dark"] .quick-action-item:hover {
  background-color: rgba(37, 99, 181, 0.15);
  border-color: var(--primary-color);
}

html[data-theme="dark"] .notification-item {
  background-color: var(--bg-card);
  border-color: var(--border-color);
}

/* =====================================================
   RESPONSIVE
===================================================== */
@media (max-width: 767px) {
  .quick-actions-panel {
    bottom: 95px; /* Mobile bottom bar'ın üstünde (76px + margin) */
    left: 15px;
    z-index: 1300; /* Mobile bottom bar panellerinin (1200) üstünde */
  }

  .admin-shortcut {
    bottom: 95px; /* Mobile bottom bar'ın üstünde (76px + margin) */
    left: 75px;
  }

  .quick-actions-menu {
    width: 240px;
  }

  .btn-back-to-top {
    bottom: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
  }

  .notification-float {
    right: 10px;
    left: 10px;
    max-width: 100%;
  }
}

/* =====================================================
   ACCESSIBILITY
===================================================== */
.quick-actions-btn:focus,
.btn-back-to-top:focus,
.admin-shortcut:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .quick-actions-btn,
  .quick-actions-menu,
  .btn-back-to-top,
  .admin-shortcut,
  .notification-item {
    transition: none;
    animation: none;
  }
}

/* =====================================================
   BACK TO TOP BUTTON - Progress Circle ile
===================================================== */
.btn-back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  border: none;
  background: white;
  color: var(--primary-color);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.btn-back-to-top:hover {
  background: var(--accent-color);
  color: var(--primary-dark);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.btn-back-to-top:hover .progress-ring__circle {
  stroke: var(--primary-dark);
}

.btn-back-to-top.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Pop-in animation when button appears */
@keyframes backtotop-pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.btn-back-to-top.show {
  animation: backtotop-pop 220ms cubic-bezier(.2,.9,.2,1);
}

/* Focus-visible style for keyboard users */
.btn-back-to-top:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(31,76,138,0.12), 0 6px 20px rgba(0,0,0,0.18);
}

/* Optional gentle pulse to attract attention (add class 'pulse' when needed) */
@keyframes backtotop-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
.btn-back-to-top.pulse {
  animation: backtotop-pulse 2000ms ease-in-out infinite;
}

/* Footer üzerinde iken daha belirgin ol */
.btn-back-to-top.on-footer {
  background: white;
  box-shadow: 0 4px 20px rgba(255, 196, 61, 0.4);
}

.btn-back-to-top.on-footer .progress-ring__circle {
  stroke: var(--accent-color);
}

/* Progress Ring SVG */
.progress-ring {
  position: absolute;
  top: -3px;
  left: -3px;
  width: 56px;
  height: 56px;
  transform: rotate(-90deg);
  pointer-events: none;
}

.progress-ring__bg {
  fill: none;
  stroke: rgba(31, 76, 138, 0.1);
  stroke-width: 3;
}

.progress-ring__circle {
  fill: none;
  stroke: var(--primary-color);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.1s linear, stroke 0.3s ease;
}

/* =====================================================
   PRINT - hide floating widgets globally
   Keep floating UI out of printouts (single source of truth)
===================================================== */
@media print {
  .quick-nav,
  .quick-actions-panel,
  .btn-back-to-top,
  .accessibility-widget,
  .quick-actions-toast,
  .notification-float {
    display: none !important;
  }

  /* Ensure printed content flows cleanly */
  .info-card,
  .content-section,
  .publisher-card,
  .platform-section {
    page-break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}

