/* =========================================
   MODAL STYLES - Login & Success Modals
   ========================================= */

/* Common Overlay for all modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active,
.modal-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* =========================================
   LOGIN CARD STYLES
   ========================================= */
.login-card {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  width: 90%;
  max-width: 400px;
  border-radius: 24px;
  padding: 40px 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.modal-overlay.active .login-card {
  transform: scale(1);
}

/* Dark Mode Login Card */
body.dark-mode .login-card {
  background: rgba(30, 30, 38, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Close Button */
.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--primary);
  transform: rotate(90deg);
}

body.dark-mode .close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent);
}

/* Login Header */
.login-header {
  text-align: center;
  margin-bottom: 25px;
}

.login-header h2 {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 5px;
}

body.dark-mode .login-header h2 {
  color: var(--accent);
}

.login-header p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Login Form */
.login-card .form-group {
  margin-bottom: 15px;
  text-align: left;
}

.login-card .form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.login-card .input-field {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

body.dark-mode .login-card .input-field {
  background: rgba(0, 0, 0, 0.2);
}

.login-card .input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(44, 47, 120, 0.1);
}

body.dark-mode .login-card .input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(251, 176, 64, 0.1);
}

/* Submit Button */
.login-card .submit-btn {
  width: 100%;
  padding: 12px;
  border-radius: 50px;
  border: none;
  background: var(--primary);
  color: white;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.login-card .submit-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

body.dark-mode .login-card .submit-btn {
  background: var(--accent);
  color: #111;
}

body.dark-mode .login-card .submit-btn:hover {
  background: #cc8a2a;
}

/* Login Links */
.login-links {
  margin-top: 20px;
  font-size: 0.85rem;
  text-align: center;
  color: var(--text-muted);
}

.login-links a {
  color: var(--primary);
  font-weight: 600;
  transition: color 0.2s ease;
}

.login-links a:hover {
  text-decoration: underline;
}

body.dark-mode .login-links a {
  color: var(--accent);
}

/* Login Error Message */
.login-error {
  margin-top: 10px;
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
  display: none;
  background: rgba(239, 68, 68, 0.1);
  padding: 8px;
  border-radius: 8px;
}

/* =========================================
   SUCCESS MODAL STYLES
   ========================================= */
.modal-content {
  background: var(--bg-card);
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 400px;
  width: 90%;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid var(--border-color);
}

.modal-overlay.is-visible .modal-content {
  transform: scale(1);
}

.modal-icon {
  width: 70px;
  height: 70px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 20px auto;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
}

.modal-text {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 25px;
  line-height: 1.5;
}

.modal-btn {
  background: var(--primary);
  color: #fff;
  padding: 10px 30px;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.modal-btn:hover {
  opacity: 0.9;
}

body.dark-mode .modal-btn {
  background: var(--accent);
  color: #111;
}

/* =========================================
   GENERIC MODAL (for forms, admin, etc.)
   ========================================= */
.generic-modal {
  width: 90%;
  max-width: 600px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-glass);
  padding: 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-backdrop.active .generic-modal {
  transform: translateY(0);
  opacity: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Modal Actions (buttons) */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border-glass);
}

/* Form elements inside generic modal */
.generic-modal .form-group {
  margin-bottom: 20px;
}

.generic-modal .form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-main);
}

.generic-modal .form-input {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-body);
  color: var(--text-main);
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.generic-modal .form-input:focus {
  outline: none;
  border-color: var(--primary);
}

body.dark-mode .generic-modal .form-input:focus {
  border-color: var(--accent);
}

.generic-modal .form-select {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  background: var(--bg-body);
  color: var(--text-main);
  cursor: pointer;
}

/* =========================================
   RESPONSIVE MODAL STYLES
   ========================================= */
@media (max-width: 600px) {
  .login-card {
    padding: 30px 20px;
  }
  
  .login-header h2 {
    font-size: 1.3rem;
  }
  
  .modal-content {
    padding: 30px 20px;
  }
  
  .modal-title {
    font-size: 1.3rem;
  }
  
  .generic-modal {
    padding: 20px;
    width: 95%;
  }
  
  .modal-actions {
    flex-direction: column;
  }
  
  .modal-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* =========================================
   ANIMATIONS
   ========================================= */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Optional: Add animation to modal content */
.modal-overlay.active .login-card,
.modal-overlay.is-visible .modal-content {
  animation: modalFadeIn 0.3s ease forwards;
}

.modal-backdrop.active .generic-modal {
  animation: modalSlideUp 0.3s ease forwards;
}

/* =========================================
   DETAILS MODAL (Library)
   ========================================= */

.details-card {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  width: 90%;
  max-width: 500px;
  border-radius: 24px;
  padding: 35px 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.modal-overlay.is-visible .details-card {
  transform: scale(1);
}

body.dark-mode .details-card {
  background: rgba(30, 30, 38, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.details-header {
  text-align: center;
  margin-bottom: 20px;
}

.details-header h2 {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 5px;
}

body.dark-mode .details-header h2 {
  color: var(--accent);
}

.details-price-display {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  margin: 15px 0;
  background: rgba(0, 0, 0, 0.03);
  padding: 10px;
  border-radius: 12px;
}

body.dark-mode .details-price-display {
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent);
}

.details-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 20px;
}

.details-body {
  max-height: 300px;
  overflow-y: auto;
  text-align: left;
  margin-bottom: 20px;
  line-height: 1.6;
  padding-right: 5px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.buy-btn {
  width: 100%;
  padding: 14px;
  border-radius: 50px;
  border: none;
  background: var(--primary);
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1rem;
}

.buy-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

body.dark-mode .buy-btn {
  background: var(--accent);
  color: #111;
}

body.dark-mode .buy-btn:hover {
  background: #cc8a2a;
}