/* ===================================
   Al-Amin Developments - Main Stylesheet
   =================================== */

/* === CSS Variables === */
:root {
  --color-primary: #C9A648;
  --color-background-light: #FFFFFF;
  --color-background-dark: #0A1A2F;
  --color-background-card: #0F213A;
  --color-white: #FFFFFF;
  --color-white-80: rgba(255, 255, 255, 0.8);
  --color-white-70: rgba(255, 255, 255, 0.7);
  --color-white-60: rgba(255, 255, 255, 0.6);
  --color-white-50: rgba(255, 255, 255, 0.5);
  --color-white-40: rgba(255, 255, 255, 0.4);
  --color-white-10: rgba(255, 255, 255, 0.1);
  --color-white-5: rgba(255, 255, 255, 0.05);
  --color-black-30: rgba(0, 0, 0, 0.3);
  --color-black-60: rgba(0, 0, 0, 0.6);

  --font-display: 'Tajawal', 'Cairo', 'Manrope', sans-serif;

  --border-radius-sm: 0.25rem;
  --border-radius-md: 0.5rem;
  --border-radius-lg: 0.75rem;
  --border-radius-xl: 1rem;
  --border-radius-2xl: 1.5rem;
  --border-radius-full: 9999px;

  --transition-fast: 150ms ease-in-out;
  --transition-normal: 300ms ease-in-out;
  --transition-slow: 500ms ease-in-out;

  --shadow-sm: 0 0 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.2);
  --shadow-primary: 0 0 20px rgba(201, 166, 72, 0.1);
}

/* === Base Styles === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-display);
  background-color: var(--color-background-dark);
  color: var(--color-white);
  line-height: 1.6;
  overflow-x: hidden;
  direction: rtl;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-fast);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* === Material Icons === */
.material-symbols-outlined {
  font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
}

/* === Scrollbar Styling === */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-background-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: var(--border-radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: #B39538;
}

/* === Image Carousel/Slider === */
.carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--border-radius-lg);
}

.carousel-inner {
  display: flex;
  transition: transform var(--transition-normal);
}

.carousel-item {
  min-width: 100%;
  transition: opacity var(--transition-normal);
}

.carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-controls {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 10;
}

.carousel-btn {
  background: rgba(0, 0, 0, 0.5);
  color: var(--color-white);
  border: none;
  padding: 0.75rem;
  border-radius: var(--border-radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

.carousel-indicators {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 10;
}

.carousel-indicator {
  width: 10px;
  height: 10px;
  border-radius: var(--border-radius-full);
  background: var(--color-white-50);
  border: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.carousel-indicator.active {
  background: var(--color-primary);
}

/* === Loading Spinner === */
.spinner {
  border: 3px solid var(--color-white-10);
  border-top: 3px solid var(--color-primary);
  border-radius: var(--border-radius-full);
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 26, 47, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* === Notification/Toast === */
.notification {
  position: fixed;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 1rem 2rem;
  border-radius: var(--border-radius-lg);
  background: var(--color-background-card);
  border: 1px solid var(--color-white-10);
  color: var(--color-white);
  box-shadow: var(--shadow-xl);
  z-index: 10000;
  animation: slideDown 0.3s ease-out;
}

.notification.success {
  border-color: #10B981;
  background: rgba(16, 185, 129, 0.1);
}

.notification.error {
  border-color: #EF4444;
  background: rgba(239, 68, 68, 0.1);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -2rem);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* === Modal === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 26, 47, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--color-background-card);
  border: 1px solid var(--color-white-10);
  border-radius: var(--border-radius-xl);
  padding: 2rem;
  min-width: 50%;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-white-10);
}

.modal-close {
  background: transparent;
  color: var(--color-white-70);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--color-white);
}

/* === Form Styles === */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  color: var(--color-white);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--color-background-dark);
  border: 1px solid var(--color-white-10);
  border-radius: var(--border-radius-md);
  color: var(--color-white);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(201, 166, 72, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-white-40);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-file-input {
  display: none;
}

.form-file-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--color-white-5);
  border: 1px solid var(--color-white-10);
  border-radius: var(--border-radius-md);
  color: var(--color-white);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.form-file-label:hover {
  background: var(--color-white-10);
}

.form-error {
  color: #EF4444;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.input-error {
  border-color: #EF4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.input-error:focus {
  border-color: #EF4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

/* === Location Select with Add Button === */
.location-select-wrapper {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.location-select-wrapper .form-select {
  flex: 1;
}

.btn-add-location {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  background: var(--color-primary);
  color: var(--color-background-dark);
  border: none;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-add-location:hover {
  background: #B39538;
  transform: translateY(-2px);
}

.btn-add-location .material-symbols-outlined {
  font-size: 1.25rem;
}

/* === Button Styles === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-weight: 700;
  font-size: 1rem;
  border-radius: var(--border-radius-lg);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-background-dark);
}

.btn-primary:hover {
  background: #B39538;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--color-white-5);
  color: var(--color-white);
  border: 1px solid var(--color-white-10);
}

.btn-secondary:hover {
  background: var(--color-white-10);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: var(--color-background-dark);
}

.btn-danger {
  background: #EF4444;
  color: var(--color-white);
}

.btn-danger:hover {
  background: #DC2626;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === Image Preview Grid === */
.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.image-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  border: 1px solid var(--color-white-10);
}

.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-remove {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: rgba(239, 68, 68, 0.9);
  color: var(--color-white);
  border: none;
  border-radius: var(--border-radius-full);
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.image-preview-item:hover .image-preview-remove {
  opacity: 1;
}

/* === Utility Classes === */
.text-primary {
  color: var(--color-primary);
}

.text-muted {
  color: var(--color-white-70);
}

.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn var(--transition-normal) ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === Responsive Design === */
@media (max-width: 768px) {
  .carousel-controls {
    padding: 0 0.5rem;
  }

  .carousel-btn {
    padding: 0.5rem;
  }

  .modal-content {
    padding: 1.5rem;
    max-width: 95%;
  }

  .image-preview-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

@media (max-width: 480px) {
  .notification {
    width: 90%;
    padding: 0.75rem 1rem;
  }
}
