/* ===================================
   Library Modal Styles
   Kütüphane Modal Tasarımı
   =================================== */

/* Modal Container */
.library-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.library-modal.modal-open {
  display: flex;
  opacity: 1;
  visibility: visible;
}

/* Modal Overlay */
.modal-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.3s ease;
}

/* Modal Container */
.modal-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: auto;
  padding: 1.5rem;
  z-index: 10000;
  animation: slideUp 0.4s ease;
}

/* Modal Wrapper */
.modal-wrapper {
  position: relative;
  background-color: var(--bg-card, #ffffff);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* Close Button */
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: var(--fs-9);
  color: var(--text-color, #333);
}

.modal-close:hover {
  background-color: var(--danger-color, #dc3545);
  color: white;
  transform: rotate(90deg);
}

/* Modal Header */
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color, #e0e0e0);
  background: linear-gradient(135deg, var(--primary-color, #1a73e8) 0%, var(--primary-dark, #1557b0) 100%);
  text-align: center;
}

.modal-title {
  margin: 0;
  font-size: var(--fs-9);
  font-weight: 600;
  color: white;
  line-height: 1.4;
}

/* Modal Body */
.modal-body {
  padding: 2rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Modal Image */
.modal-image-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  background-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-image {
  width: 100%;
  height: auto;
  max-height: 40vh;
  object-fit: contain;
  display: block;
  background-color: transparent;
}

.modal-image-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-alt, #f5f5f5);
}

.modal-image-loader .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color, #e0e0e0);
  border-top-color: var(--primary-color, #1a73e8);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Modal Description */
.modal-description {
  margin: 0;
  font-size: var(--fs-6);
  line-height: 1.5;
  color: var(--text-color, #333);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Modal Footer */
.modal-footer {
  padding: 1.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  border-top: 1px solid var(--border-color, #e0e0e0);
  background-color: var(--bg-alt, #f5f5f5);
}

/* Modal Button */
.modal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 2rem;
  font-size: var(--fs-7);
  font-weight: 500;
  color: white;
  background-color: var(--primary-color, #1a73e8);
  border: none;
  border-radius: var(--radius-md, 8px);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-button:hover {
  background-color: var(--primary-dark, #1557b0);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
  color: white;
}

/* Modal Checkbox */
.modal-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  font-size: var(--fs-5);
  color: var(--text-secondary, #666);
}

.modal-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-color, #1a73e8);
}

/* Category Styles */
.library-modal.modal-category-academic .modal-header {
  background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
}

.library-modal.modal-category-maintenance .modal-header {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.library-modal.modal-category-resource .modal-header {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.library-modal.modal-category-announcement .modal-header {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .modal-container {
    padding: 0.75rem;
    max-width: calc(100% - 1.5rem);
  }

  .modal-header {
    padding: 0.875rem 1rem;
    text-align: center;
  }

  .modal-title {
    font-size: var(--fs-7);
    line-height: 1.3;
  }

  .modal-body {
    padding: 1rem;
    overflow: hidden;
  }

  .modal-image-wrapper {
    margin-bottom: 1rem;
  }

  .modal-image {
    max-height: 25vh;
  }

  .modal-description {
    font-size: var(--fs-4);
    line-height: 1.4;
  }

  .modal-footer {
    padding: 0.875rem 1rem 1rem;
  }

  .modal-button {
    width: 100%;
    padding: 0.75rem 1.25rem;
    font-size: var(--fs-5);
  }

  .modal-checkbox {
    font-size: var(--fs-4);
  }

  .modal-close {
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    font-size: var(--fs-5);
  }
}

@media (max-width: 480px) {
  .modal-container {
    padding: 0.5rem;
    max-width: calc(100% - 1rem);
  }

  .modal-header {
    padding: 0.75rem 0.875rem;
  }

  .modal-title {
    font-size: var(--fs-6);
  }

  .modal-body {
    padding: 0.875rem;
  }

  .modal-image {
    max-height: 20vh;
  }

  .modal-description {
    font-size: var(--fs-3);
  }

  .modal-footer {
    padding: 0.75rem 0.875rem 0.875rem;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  [data-theme="dark"] .modal-wrapper {
    background-color: var(--bg-card-dark, #1e1e1e);
  }

  [data-theme="dark"] .modal-description {
    color: var(--text-color-dark, #e0e0e0);
  }

  [data-theme="dark"] .modal-close {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
  }

  [data-theme="dark"] .modal-close:hover {
    background-color: var(--danger-color, #dc3545);
  }

  [data-theme="dark"] .modal-footer {
    background-color: var(--bg-alt-dark, #2a2a2a);
  }

  [data-theme="dark"] .modal-checkbox {
    color: var(--text-secondary-dark, #a0a0a0);
  }
}

/* Accessibility */
.library-modal[aria-hidden="true"] {
  pointer-events: none;
}

.library-modal[aria-hidden="false"] {
  pointer-events: auto;
}

/* Prevent body scroll when modal is open */
body.modal-active {
  overflow: hidden;
}

/* Focus trap for accessibility */
.modal-wrapper:focus {
  outline: 2px solid var(--primary-color, #1a73e8);
  outline-offset: 2px;
}
