/* Ruqaqa Design System - Dark Theme */
:root {
  /* Colors */
  --primary: #1428a0;
  --secondary: #00a9e0;
  --accent: #20858f;
  --green: #208f5a;
  
  /* Dark theme colors */
  --bg-dark: #0a0e1a;
  --bg-darker: #060912;
  --bg-card: #111827;
  --bg-card-hover: #1a2332;
  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --text-tertiary: #6b7280;
  
  /* Gradients */
  --gradient-primary: linear-gradient(90deg, #1428a0, #00a9e0);
  --gradient-hover: linear-gradient(45deg, #1428a0, #20858f);
  --gradient-accent-green: linear-gradient(45deg, #20858f, #208f5a);
  
  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 15px 30px rgba(0, 0, 0, 0.5);
  --shadow-card: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 15px 30px rgba(0, 0, 0, 0.4);
  
  /* Spacing */
  --radius: 20px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  
  /* Transitions */
  --transition: 0.3s ease;
  
  /* Touch targets */
  --touch-target: 44px;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
  background: var(--bg-darker);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  direction: rtl;
}

/* Fixed Logo */
.fixed-logo {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  background: rgba(17, 24, 39, 0.9);
  backdrop-filter: blur(10px);
  padding: 12px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(32, 133, 143, 0.2);
  transition: all var(--transition);
}

.fixed-logo:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(32, 133, 143, 0.4);
}

.fixed-logo img {
  height: 60px;
  width: auto;
  display: block;
}

/* Mode Toggle Button */
.mode-toggle {
  position: fixed;
  bottom: 30px;
  left: 30px;
  z-index: 1000;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  background: var(--gradient-primary);
  border: none;
  border-radius: 50%;
  padding: 12px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mode-toggle:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.mode-toggle svg {
  color: white;
  width: 24px;
  height: 24px;
}

.mode-toggle.edit-mode {
  background: var(--gradient-accent-green);
}

/* Add Part Button */
.add-part-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
  min-height: var(--touch-target);
  background: var(--gradient-accent-green);
  border: none;
  border-radius: 25px;
  padding: 12px 24px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-size: 16px;
  font-weight: 600;
}

.add-part-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(32, 143, 90, 0.4);
}

.add-part-btn svg {
  width: 20px;
  height: 20px;
}

/* Logout Button */
.logout-btn {
  position: fixed;
  top: 30px;
  left: 30px;
  z-index: 1000;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  background: rgba(239, 68, 68, 0.9);
  border: none;
  border-radius: 50%;
  padding: 12px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.logout-btn:hover {
  transform: translateY(-2px) scale(1.05);
  background: rgba(239, 68, 68, 1);
  box-shadow: 0 20px 40px rgba(239, 68, 68, 0.4);
}

.logout-btn svg {
  width: 20px;
  height: 20px;
}

/* Parts Container */
.parts-container {
  overflow-y: scroll;
  height: 100vh;
  scroll-behavior: smooth;
}

/* Hide scrollbar but keep functionality */
.parts-container::-webkit-scrollbar {
  width: 8px;
}

.parts-container::-webkit-scrollbar-track {
  background: var(--bg-darker);
}

.parts-container::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

.parts-container::-webkit-scrollbar-thumb:hover {
  background: var(--green);
}

/* Part Section */
.part-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 40px 40px;
  position: relative;
}

.part-section.edit-mode {
  padding: 100px 40px 60px;
}

/* Part Content */
.part-content {
  max-width: 900px;
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 48px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all var(--transition);
}

.part-section.edit-mode .part-content {
  border: 1px solid rgba(32, 133, 143, 0.3);
  box-shadow: 0 0 0 1px rgba(32, 133, 143, 0.1), var(--shadow-card);
}

.part-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.part-image {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}

.part-movement {
  font-size: 1.1rem;
  color: var(--green);
  font-style: italic;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(32, 143, 90, 0.1);
  border-right: 4px solid var(--green);
  border-radius: var(--radius-xs);
}

.part-text {
  font-size: 1.2rem;
  line-height: 2;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Edit Controls */
.part-controls {
  display: none;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.part-section.edit-mode .part-controls {
  display: flex;
}

.part-controls button {
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-edit {
  background: var(--gradient-primary);
  color: white;
  flex: 1;
}

.btn-edit:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-delete {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-delete:hover {
  background: rgba(239, 68, 68, 0.3);
  transform: translateY(-2px);
}

.btn-move {
  background: rgba(32, 133, 143, 0.2);
  color: var(--accent);
  border: 1px solid rgba(32, 133, 143, 0.3);
  padding: 10px;
}

.btn-move:hover {
  background: rgba(32, 133, 143, 0.3);
  transform: translateY(-2px);
}

.btn-move:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-move:disabled:hover {
  transform: none;
}

.btn-move svg {
  width: 20px;
  height: 20px;
}

/* Empty State */
.empty-state {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.empty-state-content {
  text-align: center;
  max-width: 500px;
}

.empty-state-content svg {
  color: var(--accent);
  margin: 0 auto 24px;
  opacity: 0.5;
}

.empty-state-content h2 {
  font-size: 2rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.empty-state-content p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 32px;
}

.empty-add-btn {
  background: var(--gradient-accent-green);
  color: white;
  border: none;
  border-radius: var(--radius-xs);
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
  min-height: var(--touch-target);
}

.empty-add-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(32, 133, 143, 0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
}

.modal-close {
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 10px;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* Form Styles */
.part-form {
  padding: 32px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 14px;
}

.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-darker);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  transition: all var(--transition);
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(32, 133, 143, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

/* Image Upload */
.image-upload-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.image-upload-btn {
  background: var(--bg-darker);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xs);
  padding: 16px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch-target);
  font-weight: 600;
}

.image-upload-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(32, 133, 143, 0.05);
}

.image-upload-btn.drag-over {
  border-color: var(--green);
  color: var(--green);
  background: rgba(32, 143, 90, 0.1);
  transform: scale(1.02);
  box-shadow: 0 0 0 4px rgba(32, 143, 90, 0.1);
}

.image-preview {
  position: relative;
  border-radius: var(--radius-xs);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.image-preview img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
  background: var(--bg-darker);
}

.remove-image-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  min-width: 36px;
  min-height: 36px;
  background: rgba(239, 68, 68, 0.9);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  padding: 8px;
}

.remove-image-btn:hover {
  background: rgba(239, 68, 68, 1);
  transform: scale(1.1);
}

/* Login Modal */
.login-modal-content {
  max-width: 450px;
}

.login-form {
  padding: 32px;
}

.login-error {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 12px 16px;
  border-radius: var(--radius-xs);
  margin-bottom: 20px;
  font-size: 14px;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary,
.btn-secondary {
  flex: 1;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  min-height: var(--touch-target);
}

.btn-primary {
  background: var(--gradient-accent-green);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .fixed-logo {
    top: 12px;
    right: 12px;
    padding: 8px;
  }
  
  .fixed-logo img {
    height: 40px;
  }
  
  .mode-toggle {
    bottom: 20px;
    left: 20px;
    min-width: 50px;
    min-height: 50px;
  }
  
  .add-part-btn {
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    font-size: 14px;
  }
  
  .logout-btn {
    top: 20px;
    left: 20px;
    min-width: 50px;
    min-height: 50px;
  }
  
  .part-section {
    padding: 60px 20px 20px;
  }
  
  .part-content {
    padding: 32px 24px;
  }
  
  .part-title {
    font-size: 1.8rem;
  }
  
  .part-text {
    font-size: 1rem;
    line-height: 1.8;
  }
  
  .part-movement {
    font-size: 0.95rem;
  }
  
  .modal-content {
    max-height: 95vh;
  }
  
  .modal-header,
  .part-form {
    padding: 20px;
  }
  
  .part-controls {
    flex-wrap: wrap;
  }
  
  .btn-edit {
    flex: 1 1 100%;
  }
}

@media (max-width: 480px) {
  .part-title {
    font-size: 1.5rem;
  }
  
  .part-text {
    font-size: 0.95rem;
  }
  
  .empty-state-content h2 {
    font-size: 1.5rem;
  }
  
  .empty-state-content p {
    font-size: 1rem;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Styles for Keyboard Navigation */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .fixed-logo,
  .mode-toggle,
  .add-part-btn,
  .part-controls {
    display: none !important;
  }
  
  .part-section {
    page-break-inside: avoid;
    min-height: auto;
    padding: 20px;
  }
}

