/* ========================================
   Recipes Generator - Enhanced CSS with Print View
   الإصدار: 4.3 (شعار Pinterest SVG)
   ======================================== */

/* ==================
   المتغيرات العامة
   ================== */
:root {
  /* الألوان الأساسية */
  --primary-color: #e67e22;
  --primary-hover: #d35400;
  --secondary-color: #3498db;
  --success-color: #27ae60;
  --warning-color: #f39c12;
  --danger-color: #e74c3c;
  
  /* الألوان النصية */
  --text-dark: #2c3e50;
  --text-medium: #555;
  --text-light: #7f8c8d;
  
  /* الألوان الخلفية */
  --bg-white: #ffffff;
  --bg-light: #f8f9fa;
  --bg-gray: #e9ecef;
  --border-color: #ddd;
  
  /* التظليل والحواف */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 15px rgba(0, 0, 0, 0.12);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  
  /* تم تكبير الخطوط (من الإصدار 4.2) */
  --font-xs: 0.85rem;    /* 13.6px */
  --font-sm: 0.95rem;    /* 15.2px */
  --font-base: 1rem;     /* 16px */
  --font-md: 1.1rem;     /* 17.6px */
  --font-lg: 1.3rem;     /* 20.8px */
  --font-xl: 1.5rem;     /* 24px */
  --font-2xl: 1.8rem;    /* 28.8px */
  
  /* Pinterest Red */
  --pinterest-red: #e60023;
}

/* ==================
   إعادة تعيين أساسية
   ================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
  line-height: 1.6;
  color: var(--text-dark);
  background: #fafafa;
  font-size: var(--font-base);
}

/* ==================
   الحاوية الرئيسية
   ================== */
.ccm-card {
  max-width: 800px;
  margin: 30px auto;
  padding: 0;
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: visible;
}

.ccm-wrapper {
  padding: var(--spacing-lg);
  position: relative;
}

/* ==================
   Pinterest Pin Button (في الزاوية)
   ================== */
.cmm-pinit-btn {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 40px;
  height: 40px;
  background: var(--pinterest-red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(230, 0, 35, 0.4);
  transition: all 0.3s ease;
  border: 3px solid white;
  padding: 5px; /* مسافة داخلية لشعار SVG */
}

.cmm-pinit-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 6px 20px rgba(230, 0, 35, 0.5);
}

/* تم حذف الكود الخاص بـ ::before هنا */

.cmm-pinit-btn svg {
    fill: white;
    width: 100%;
    height: 100%;
    display: block;
}

/* ==================
   قسم المعلومات العلوي
   ================== */
.ccm-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  padding: 15px 20px;
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-color);
  margin: -20px -20px 20px -20px;
}

.ccm-info-child {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-sm); /* تم تكبيره */
}

.ccm-info-child strong {
  color: var(--text-dark);
  font-weight: 600;
}

/* عدد الحصص (مُعدَّل ليتناسب مع هيكل الـ JS القديم) */
.ccm-yield {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ccm-yield-adjuster-wrapper {
    flex-grow: 1; 
    justify-content: flex-start;
}

.yield-adjuster-controls {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.yield-button {
    background: var(--bg-gray);
    color: var(--text-dark);
    border: none;
    padding: 6px 12px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    line-height: 1;
}

.yield-button:hover {
    background: var(--primary-color);
    color: white;
}

#yield-input {
    width: 50px;
    text-align: center;
    border: none;
    padding: 6px 0;
    font-size: var(--font-base);
    font-weight: 600;
    -moz-appearance: textfield; /* لإخفاء الأسهم في Firefox */
    appearance: textfield;
}

#yield-input::-webkit-outer-spin-button,
#yield-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.yield-unit-display {
    font-size: var(--font-sm); /* تم تكبيره */
    color: var(--text-medium);
    margin-left: 5px;
}


/* المؤلف */
.ccm-author {
  color: var(--text-light);
  flex-grow: 1;
  justify-content: center;
}

.ccm-author span {
  color: var(--text-dark);
  font-weight: 600;
}

/* زر الطباعة والمشاركة */
.ccm-btns-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ccm-printbutton, .ccm-sharebutton {
  padding: 8px 18px;
  background: #93c47d;
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--font-sm); /* تم تكبيره */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  white-space: nowrap;
}
.ccm-sharebutton {
    background: var(--secondary-color);
}

.ccm-printbutton:hover {
  background: #76a95d;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(147, 196, 125, 0.4);
}
.ccm-sharebutton:hover {
  background: #2980b9;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(52, 152, 219, 0.4);
}

/* ==================
   قسم الصورة والعنوان
   ================== */
.ccm-flex-b {
  display: flex;
  gap: 25px;
  margin-bottom: 25px;
  align-items: flex-start;
}

.ccm-image {
  flex: 0 0 200px;
  max-width: 200px;
}

.ccm-image img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: block;
  aspect-ratio: 1/1; 
  object-fit: cover;
}

.ccm-info-wrapper {
  flex: 1;
  min-width: 0;
}

.ccm-name {
  font-size: var(--font-2xl);
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
  line-height: 1.3;
  text-align: center;
}

/* التقييم */
.rating-display {
    text-align: center;
    margin: 15px 0 25px 0;
    padding-bottom: 15px;
    border-bottom: 1px dashed var(--border-color);
}

.rating-summary {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.interactive-stars {
    font-size: 1.4em;
    color: #ffc107; 
    display: inline-block;
    cursor: pointer;
    white-space: nowrap;
}

.interactive-stars .star {
    opacity: 0.3;
    transition: opacity 0.2s;
}

.interactive-stars .star.rated,
.interactive-stars.rating-input .star:hover,
.interactive-stars.rating-input .star.hover-highlight {
    opacity: 1;
}

.rating-text {
    font-size: var(--font-sm); /* تم تكبيره */
    color: var(--text-light);
}

.rating-message {
    font-size: var(--font-sm); /* تم تكبيره */
    font-weight: 500;
    margin-top: 5px;
}

/* الوصف */
.ccm-summary {
  font-size: var(--font-base); /* 16px */
  color: var(--text-medium);
  line-height: 1.7;
  text-align: center;
  font-style: italic;
  margin-top: 12px;
}

/* ==================
   قسم الأوقات
   ================== */
.ccm-time {
  display: flex;
  justify-content: space-around;
  gap: 10px;
  padding: 15px;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.ccm-time-child {
  font-size: var(--font-sm); /* تم تكبيره */
  color: var(--text-medium);
  text-align: center;
  white-space: nowrap;
  font-weight: 600;
}

/* ==================
   العناوين الرئيسية
   ================== */
.ccm-head {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--text-dark);
  margin: 25px 0 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--text-dark);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ==================
   قسم المكونات
   ================== */
.ccm-section-ingredients {
  margin-bottom: 30px;
}

.ccm-section-items {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ccm-section-ingredients .ccm-section-items li {
  padding: 10px 15px;
  margin: 8px 0;
  background: var(--bg-white);
  border: 1px solid var(--bg-gray);
  border-left: 4px solid var(--primary-color);
  border-radius: var(--radius-sm);
  font-size: var(--font-base); /* تم تكبيره */
  color: var(--text-dark);
  line-height: 1.5;
  transition: all 0.2s;
}

.ccm-section-ingredients .ccm-section-items li:hover {
    border-left-color: var(--primary-hover);
    background: #fffafa;
}

/* ==================
   قسم التعليمات
   ================== */
.ccm-section-instructions {
  margin-bottom: 30px;
}

.ccm-section-instructions ol {
  list-style-type: none;
  padding: 0;
  counter-reset: step-counter;
}

.ccm-section-instructions ol li {
  counter-increment: step-counter;
  padding: 15px 15px 15px 55px;
  margin-bottom: 15px;
  background: var(--bg-light);
  border-left: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  position: relative;
  font-size: var(--font-base); /* تم تكبيره */
  color: var(--text-medium);
  line-height: 1.6;
}

.ccm-section-instructions ol li::before {
  content: counter(step-counter);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 28px;
  height: 28px;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--font-sm);
}

.ccm-section-instructions li strong {
    color: var(--text-dark);
    font-weight: 700;
}
.ccm-section-instructions li .step-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 15px 0 5px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

/* ==================
   قسم الملاحظات
   ================== */
.ccm-notes {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 15px;
  margin-bottom: 25px;
}

.ccm-notes .ccm-head {
  font-size: var(--font-lg);
  margin-top: 0;
  margin-bottom: 12px;
  border-bottom: none;
  padding-bottom: 0;
  text-transform: none;
  letter-spacing: normal;
}

.ccm-notes-inner {
  color: var(--text-medium);
  line-height: 1.6;
  font-size: var(--font-sm); /* تم تكبيره */
}

.ccm-notes-inner p {
  margin-bottom: 8px;
}

/* ==================
   قسم الكلمات المفتاحية والفيديو
   ================== */
.ccm-keywords {
    margin-bottom: 25px;
}
.ccm-keywords .keywords-list {
    font-size: var(--font-sm); /* تم تكبيره */
    color: var(--text-medium);
    padding: 5px 0;
}

.recipe-video {
    margin-bottom: 25px;
}
.recipe-video h2 {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--text-dark);
    margin: 25px 0 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--text-dark);
}
.recipe-video .video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: #000;
    border-radius: var(--radius-sm);
}
.recipe-video .video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ==================
   قسم التغذية
   ================== */
.ccm-section-nutrition {
    margin-top: 30px;
    padding: 15px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.ccm-section-nutrition .ccm-head {
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom-color: var(--primary-color);
}

.ccm-nutrition-info {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.ccm-nut-fact {
    background: white;
    padding: 10px;
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.ccm-nut-fact span {
    font-size: var(--font-sm); /* تم تكبيره */
    color: var(--text-light);
    margin-bottom: 3px;
    font-weight: 500;
}

.ccm-nut-fact strong {
    font-size: var(--font-base); /* تم تكبيره */
    color: var(--text-dark);
    font-weight: 700;
    display: block;
}

/* ==================
   Footer
   ================== */
.ccm-footer {
    text-align: center;
    padding-top: 20px;
    margin-top: 25px;
    border-top: 1px solid var(--border-color);
    font-size: var(--font-sm); /* تم تكبيره */
    color: var(--text-light);
}

/* ==================
   أزرار المشاركة (الجديدة)
   ================== */
.ccm-share-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 25px 0;
  padding: 20px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.ccm-share-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s;
  cursor: pointer;
  text-decoration: none;
}

.ccm-share-btn:hover {
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ccm-share-btn svg {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}


/* ==================
   الاستجابة والطباعة
   ================== */
@media (max-width: 768px) {
  .ccm-flex-b {
    flex-direction: column;
    align-items: center;
  }
  
  .ccm-image {
    flex: 0 0 100%;
    max-width: 250px;
  }
  
  .ccm-name, .ccm-summary {
    text-align: center;
  }
  
  .ccm-time {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .ccm-nutrition-info {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .ccm-info {
    justify-content: center;
  }
  .ccm-btns-wrapper {
      width: 100%;
      justify-content: space-around;
  }
}

@media (max-width: 480px) {
  .ccm-card {
    margin: 10px;
    box-shadow: none;
    border: none;
  }
  
  .ccm-wrapper {
    padding: 12px;
  }
  
  .ccm-name {
    font-size: var(--font-xl);
  }
  
  .ccm-nutrition-info {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .ccm-info {
    padding: 10px;
    margin: -12px -12px 15px -12px;
  }
}


/* Print Styles */
@media print {
  body * { visibility: hidden; }
  .ccm-card, .ccm-card * {
      visibility: visible;
      color: #000 !important;
  }
  .ccm-card {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      max-width: none !important; 
      margin: 0;
      padding: 10px;
      box-shadow: none;
      border: none;
      background: #fff;
  }
  .cmm-pinit-btn, .ccm-hide-on-print, .recipe-video, .ccm-share-buttons {
      display: none !important;
  }
  .ccm-info, .ccm-footer {
      border: none;
      background: transparent;
      padding: 0;
  }
  .ccm-flex-b {
      flex-direction: row;
      align-items: flex-start;
      gap: 15px;
  }
  .ccm-image {
      flex: 0 0 150px;
      max-width: 150px;
  }
  .ccm-image img {
      box-shadow: none;
      border: 1px solid #000;
  }
  .ccm-name, .ccm-summary {
      text-align: left;
      margin-top: 0;
  }
  .ccm-time {
      background: var(--bg-gray);
      border: 1px solid #000;
      page-break-inside: avoid;
  }
  .ccm-head {
      border-bottom: 2px solid #000;
      page-break-after: avoid;
  }
  .ccm-section-ingredients .ccm-section-items li, 
  .ccm-section-instructions ol li {
      page-break-inside: avoid;
      background: #fff;
      border: 1px solid #ddd;
      border-left-color: #000;
  }
  .ccm-section-instructions ol li::before {
      background: #000;
  }
  .ccm-notes, .ccm-section-nutrition, .ccm-nutrition-info {
      background: transparent;
      border: 1px solid #000;
      page-break-inside: avoid;
  }
  .ccm-nut-fact {
      background: transparent;
      border: 1px solid #ddd;
  }
}

/* ========================================
   Pin This & Jump to Recipe Buttons CSS
   ======================================== */

/* ==================
   Button Wrapper
   ================== */
.ccm-jump-button-wrapper {
    display: flex;
    gap: 12px;
    margin: 25px 0;
    flex-wrap: wrap;
    align-items: center;
}

/* ==================
   Base Button Styles (مشترك)
   ================== */
.ccm-pin-button,
.ccm-jump-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 24px;
    border: none;
    border-radius: 30px; /* حواف مستديرة عصرية */
    font-size: 14px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* انتقال حركي ناعم */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

/* ==================
   Pinterest Pin Button (وردي)
   ================== */
.ccm-pin-button {
    background-color: #fce4ec; /* وردي فاتح جداً */
    color: #c2185b !important; /* وردي داكن للنص (مهم إضافة !important لضمان تجاوز التنسيق الافتراضي) */
}

.ccm-pin-button:hover {
    background-color: #f8bbd0;
    box-shadow: 0 4px 14px rgba(194, 24, 91, 0.25);
    transform: translateY(-2px); /* تأثير الارتفاع عند التمرير */
}

.ccm-pin-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ==================
   Jump to Recipe Button (بيج)
   ================== */
.ccm-jump-button {
    background-color: #f5e6d3; /* بيج/كريمي */
    color: #6d4c41 !important; /* بني للنص (مهم إضافة !important) */
}

.ccm-jump-button:hover {
    background-color: #ead5bf; 
    box-shadow: 0 4px 14px rgba(109, 76, 65, 0.25);
    transform: translateY(-2px); /* تأثير الارتفاع عند التمرير */
}

.ccm-jump-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    stroke-width: 2.5;
}

/* ==================
   Responsive - Mobile (480px)
   ================== */
@media (max-width: 480px) {
    .ccm-jump-button-wrapper {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .ccm-pin-button,
    .ccm-jump-button {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }
}

/* ==================
   Print Styles
   ================== */
@media print {
    .ccm-jump-button-wrapper {
        display: none !important;
    }
}