/* =========================================
 * MAIN STYLES - CLEANED & CONSOLIDATED
 * Custom CSS for Permalist Project
 * ========================================= */



/* ========== 1. Variables & Theme ========== */
:root {
  --main-color: #e0002d;
  --main-color-dark: #b80024;
  --main-color-rgb: 224, 0, 45;
  --main-bg: #f8f9fa;
  --main-text: #212529;
  --main-border: #dee2e6;
  --main-light: #fff;
}

.navbar-logo {
  max-height: 36px;
  width: auto;
  object-fit: contain;
} 

@media (max-width: 992px) {
  .navbar-logo {
    max-height: 30px;
  }
}

/* ========== 2. Base Layout & Typography ========== */
html, body {
  background: var(--main-bg);
  color: var(--main-text);
  font-family: 'Cairo', Arial, sans-serif;
  text-align: right;
  min-height: 100vh;
  height: 100%;
  display: flex;
  flex-direction: column;
}

body, main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: var(--main-color);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover, a:focus {
  color: var(--main-color-dark);
}

h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6, .card-title {
  color: var(--main-color);
  font-weight: 500;
  letter-spacing: 0.5px;
}

p, .card-text {
  line-height: 1.7;
  margin-bottom: 1rem;
}

::placeholder {
  color: #adb5bd;
  opacity: 1;
  font-weight: 300;
}

img {
  max-width: 100%;
  height: auto;
}

/* ========== 3. Navbar ========== */
.navbar, .navbar-custom {
  background-color: var(--main-light) !important;
  box-shadow: 0 0.125rem 0.25rem rgba(var(--main-color-rgb), 0.07);
  padding-top: 0.8rem;
  padding-bottom: 0.8rem;
}
.navbar-brand {
  font-weight: 700;
  color: var(--main-color) !important;
  letter-spacing: 1px;
}
.navbar-nav .nav-link {
  color: var(--main-color);
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}
.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
  background: var(--main-color) !important;
  color: #fff !important;
}

/* Search form in navbar */
.search-form-wrapper {
  display: flex;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  border-radius: 20px;
  transition: all 0.3s;
}
.search-form-wrapper:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  transform: translateY(-2px);
}
.search-input {
  border: 1px solid #ddd;
  border-right: none;
  padding-right: 15px;
}
.search-button {
  border: none;
  background-color: var(--main-color);
  color: white;
  padding: 0.25rem 1rem;
}
.search-button:hover {
  background-color: var(--main-color-dark);
  box-shadow: inset 0 0 0 100px rgba(0,0,0,0.1);
}

/* ========== 4. Cards & Content ========== */
.card {
  border: 1px solid var(--main-border);
  border-radius: 1rem;
  background: var(--main-light);
  box-shadow: 0 0.25rem 0.75rem rgba(var(--main-color-rgb), 0.05);

}
.card-img-top, .card-img-top-fixed-height {
  height: 220px;
  object-fit: cover;
  width: 100%;
  border-top-left-radius: 1rem;
  border-top-right-radius: 1rem;
}
.card-body {
  padding-bottom: 0.5rem;
}
.card-desc-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  max-height: 5.1em;
  min-height: 3em;
  white-space: normal;
  font-size: 0.97rem;
}
.card-actions {
  display: flex;
  flex-direction: row-reverse;
  gap: 0.5rem;
}

/* ========== 5. Buttons ========== */
.btn-danger, .btn-main {
  background-color: var(--main-color) !important;
  border-color: var(--main-color) !important;
  color: #fff !important;
  transition: all 0.3s;
}
.btn-danger:hover, .btn-main:hover,
.btn-danger:focus, .btn-main:focus {
  background-color: var(--main-color-dark) !important;
  border-color: var(--main-color-dark) !important;
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.btn-outline-secondary, .custom-action-btn {
  border-color: var(--main-color) !important;
  color: var(--main-color) !important;
  background: transparent !important;
  transition: all 0.3s;
}
.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.custom-action-btn:hover,
.custom-action-btn:focus {
  background: var(--main-color) !important;
  color: #fff !important;
  border-color: var(--main-color) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.btn-light:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}
.btn-icon {
  padding: 0.25rem 0.5rem;
  background: transparent;
  border: none;
  line-height: 1;
}
.btn-icon .icon, .fa-solid {
  height: 1.1em;
  width: auto;
  vertical-align: middle;
  color: var(--main-color);
  transition: color 0.2s;
}
.btn-icon:hover .icon, .btn-icon:hover .fa-solid {
  color: var(--main-color-dark);
}
.custom-action-btn .fa-pen-to-square,
.custom-action-btn .fa-trash {
  color: var(--main-color);
  transition: color 0.2s;
}
.custom-action-btn:hover .fa-pen-to-square,
.custom-action-btn:focus .fa-pen-to-square,
.custom-action-btn:hover .fa-trash,
.custom-action-btn:focus .fa-trash {
  color: #fff;
}
.btn-success {
  transition: all 0.3s;
}
.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.btn-outline- danger {
  color: var(--main-color);
  border-color: var(--main-color);
}
.btn-outline- danger:hover {
  background-color: var(--main-color);
  border-color: var(--main-color);
  color: white;
}

/* ========== 6. Forms & Inputs ========== */
.form-label {
  font-weight: 400;
  color: var(--main-color-dark);
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
}
.form-control, .form-select {
  font-weight: 300;
  border-color: var(--main-border);
  padding: 0.6rem 0.75rem;
  border-right: none;
  transition: all 0.3s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--main-color);
  box-shadow: 0 0 0 0.25rem rgba(var(--main-color-rgb), 0.15);
}
.input-group {
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border-radius: 0.375rem;
  overflow: hidden;
}
.input-group-text {
  background-color: #f8f9fa;
  border-left: none;
  min-width: 40px;
  display: flex;
  justify-content: center;
  border-color: #e2e8f0;
}
.form-control:focus + .input-group-text {
  border-color: var(--main-color);
}
textarea.form-control {
  border: 1px solid #ced4da;
}
textarea.form-control:focus {
  box-shadow: 0 0 0 0.25rem rgba(var(--main-color-rgb), 0.15);
}
label {
  font-weight: 500;
  margin-bottom: 0.5rem;
}
.shadow-sm {
  box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
}
.form-check-input:checked {
  background-color: var(--main-color);
  border-color: var(--main-color);
}
.form-switch .form-check-input {
  width: 2.5em;
  height: 1.25em;
}

/* ========== 7. Pagination ========== */
.custom-pagination {
  display: flex;
  gap: 5px;
}
.custom-pagination .page-link {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  border: 1px solid #ddd;
  font-weight: 500;
  transition: all 0.2s;
}
.custom-pagination .page-item.active .page-link {
  background-color: var(--main-color);
  border-color: var(--main-color);
  color: white;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.custom-pagination .page-item:not(.active) .page-link:hover {
  background-color: #f8f9fa;
  color: var(--main-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.custom-pagination .page-item.disabled .page-link {
  color: #ccc;
  background-color: #f9f9f9;
  border-color: #eee;
}
.pagination-info {
  color: #777;
  font-size: 0.9rem;
}

/* ========== 8. Carousel ========== */
.carousel-item {
  height: 350px;
}
.carousel-item img {
  object-fit: contain;
  height: 100%;
  width: 100%;
  border-radius: 4px;
  background: #f8f9fa;
}
.carousel-control-prev,
.carousel-control-next {
  width: 40px;
  height: 40px;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0,0,0,0.2);
  border-radius: 50%;
}
.carousel-indicators {
  margin-bottom: -1rem;
}

/* ========== 9. Thumbnails & Media ========== */
.single-item-thumbnail,
.img-thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border: 2px solid transparent;
  padding: 0.15rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s, border-color 0.2s;
  border-radius: 0.5rem;
}
.single-item-thumbnail:hover,
.single-item-thumbnail.active,
.img-thumbnail:hover,
.img-thumbnail.active {
  opacity: 1;
  border-color: var(--main-color);
}
.edit-image-thumb {
  position: relative;
  display: inline-block;
}
.delete-image-btn {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 2;
  padding: 2px 6px;
  font-size: 0.9rem;
  opacity: 0.85;
}
.delete-image-btn:hover {
  opacity: 1;
}

/* ========== 10. Footer ========== */
.site-footer {
  background: linear-gradient(135deg, var(--main-color) 0%, var(--main-color-dark) 100%);
  color: #fff;
  width: 100%;
  margin-top: auto;
  padding: 2.5rem 0 2rem;
}
.footer-content {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  text-align: right;
}
.footer-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.footer-heading {
  color: white;
  font-weight: bold;
  margin-bottom: 1.5rem;
  padding-right: 0.75rem;
  border-right: 3px solid #fff;
  position: relative;
  text-align: right;
  width: fit-content;
}
.footer-text {
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
.social-icons {
  display: flex;
  gap: 12px;
  margin-top: 1.2rem;
  justify-content: flex-start;
}
.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.15);
  color: white !important;
  text-decoration: none;
  transition: all 0.3s ease;
}
.social-icon i {
  color: white !important;
  font-size: 1rem;
}
.social-icon:hover {
  background-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px);
}
.footer-contact {
  list-style: none;
  padding: 0;
  margin: 0;
}
.contact-item {
  margin-bottom: 1.2rem;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: flex-start;
}
.contact-icon {
  color: white !important;
  margin-left: 12px;
  width: 18px;
  text-align: center;
}
.footer-divider {
  height: 1px;
  background-color: rgba(255, 255, 255, 0.2);
  margin: 2.5rem 0;
  width: 100%;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
}
.footer-copyright {
  text-align: center;
  width: 100%;
  max-width: none;
  padding-top: 1rem;
}
.footer-copyright p {
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
}
.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-links li {
  margin-bottom: 1rem;
}
.footer-link {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
}
.footer-link i {
  color: white !important;
  margin-left: 8px;
  font-size: 0.8rem;
}
.footer-link:hover {
  color: white;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .footer-column {
    align-items: flex-start;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
  }
}
@media (max-width: 576px) {
  .footer-content {
    padding: 0 1.5rem;
  }
}

/* ========== 11. Utility & Responsive ========== */
.icon-sm {
  height: 1.2em;
  width: 1.2em;
  vertical-align: middle;
}
.icon-md {
  height: 1.5em;
  width: 1.5em;
  vertical-align: middle;
}
@media (max-width: 991.98px) {
  .single-item-carousel-image,
  .carousel-item { height: 220px; }
}
@media (max-width: 767.98px) {
  .single-item-carousel-image,
  .carousel-item { height: 140px; }
  .single-item-thumbnail, .img-thumbnail { max-width: 50px; }
  .col-md-4 { border-radius: 0 0 0.5rem 0.5rem !important; }
}
@media (max-width: 575.98px) {
  .single-item-carousel-image,
  .carousel-item { height: 90px; }
  .single-item-thumbnail, .img-thumbnail { max-width: 32px; }
  .card-actions { flex-direction: column; align-items: stretch; gap: 0.5rem; margin-top: 1rem; }
}

/* ========== 12. Select2 (if used) ========== */
.select2-container--default .select2-selection--single {
  height: 38px !important;
  padding: 5px 10px !important;
  display: flex !important;
  align-items: center !important;
  border-radius: 6px !important;
  border-color: #ced4da !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  text-align: right !important;
  padding-right: 0 !important;
  padding-left: 20px !important;
  line-height: 1.5 !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 38px !important;
  left: 5px !important;
  right: auto !important;
}
.select2-dropdown {
  z-index: 9999 !important;
  border-color: var(--main-color) !important;
  border-radius: 6px !important;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1) !important;
}
.select2-search--dropdown .select2-search__field {
  padding: 8px !important;
  border-radius: 4px !important;
  text-align: right !important;
  direction: rtl !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--main-color) !important;
}
.select2-container--default .select2-results__option {
  padding: 8px 10px !important;
  text-align: right;
}
.select2-container--open .select2-dropdown {
  right: auto;
  left: 0;
}

.card-body > div {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.card-desc-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  min-height: 72px; /* ارتفاع ثابت تقريبي لثلاثة أسطر */
}
.divider-fixed {
  height: 3px;
  opacity: 0.15;
  margin-bottom: 0 !important;
  margin-top: 1rem;
}