/* ==========================================================================
   Course Comparator Pro – Frontend UI v2.1.1
   Fonts: Inter, Poppins  |  Accent colour via --cc-accent
   RTL (Arabic) support included.
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700;800&display=swap');

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Selected course card */
.course-listing-card.cc-selected-card {
    border: 2px solid var(--cc-accent, #BC1C24) !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    transition: border 0.3s ease, border-radius 0.3s ease;
    box-shadow: 0 4px 15px rgba(188, 28, 36, 0.1) !important;
}

/* Overlay & Modal */
#cc-custom-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(17, 24, 39, 0.65);
    -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
    z-index: 999999; display: none; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s ease;
}
#cc-custom-overlay.cc-show { display: flex; opacity: 1; }

.cc-modal-wrapper {
    background: #fff; padding: 28px; border-radius: 16px; color: #111827;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    width: 95%; max-width: 1200px; max-height: 90vh; overflow-y: auto;
    box-sizing: border-box; font-family: 'Inter', sans-serif;
}

/* Header */
.cc-header {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #e5e7eb; padding-bottom: 16px; margin-bottom: 20px;
}
.cc-title {
    font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 20px;
    color: #111827; margin: 0;
}
.cc-actions { display: flex; gap: 12px; }

.cc-btn {
    display: flex; align-items: center; gap: 6px; padding: 8px 18px;
    font-size: 13px; font-weight: 600; border-radius: 9999px; cursor: pointer;
    border: none; transition: all 0.2s; font-family: 'Inter', sans-serif;
}
.cc-btn:hover { opacity: 0.9; }
.cc-btn-pdf { background: var(--cc-accent, #BC1C24); color: #fff; }
.cc-btn-close-popup {
    background: #f9fafb; color: #374151; border: 1px solid #e5e7eb;
}
.cc-btn-close-popup:hover { background: #f3f4f6; color: var(--cc-accent); border-color: var(--cc-accent); }

/* Loader */
.cc-loader-wrapper { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px; }
.cc-loader {
    width: 36px; height: 36px; border: 3px solid #f3f4f6;
    border-top: 3px solid var(--cc-accent); border-radius: 50%;
    animation: ccSpin 0.8s linear infinite;
}
@keyframes ccSpin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Export wrapper – horizontal scroll only on mobile when needed */
.cc-export-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 1025px) {
    .cc-export-wrapper { overflow-x: visible; }
}

/* Grid chunk – flex table */
.cc-grid-chunk {
    border: 1px solid #e5e7eb; border-radius: 10px; margin-bottom: 20px; overflow: hidden;
}
.cc-row {
    display: flex; width: 100%; align-items: stretch; border-bottom: 1px solid #f3f4f6;
}
.cc-cell {
    padding: 14px 12px; display: flex; align-items: center; justify-content: flex-start;
    text-align: start; /* direction-aware */
    word-break: break-word; box-sizing: border-box;
}
.cc-label-col {
    width: 110px; min-width: 110px; font-size: 12.5px; font-weight: 600;
    color: #6b7280; background: #fafafa;
}
.cc-value-col {
    flex: 1 1 0%;
    min-width: 0;
}
.cc-border-left { border-left: 1px solid #f3f4f6; }
.cc-course-header {
    position: relative; padding: 18px 12px 14px; display: flex;
    flex-direction: column; align-items: flex-start; text-align: start;
}
.cc-col-dismiss {
    position: absolute; top: 10px; right: 10px; width: 24px; height: 24px;
    border-radius: 50%; background: #fff; border: 1px solid #e5e7eb; color: #9ca3af;
    font-size: 12px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s; padding: 0; z-index: 2;
}
.cc-col-dismiss:hover { border-color: var(--cc-accent); color: var(--cc-accent); }
.cc-logo {
    width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center;
    justify-content: center; color: #fff; font-weight: 700; font-size: 18px;
    margin-bottom: 10px; overflow: hidden;
}
.cc-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cc-course-title {
    font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 13px;
    margin: 0 0 4px; color: #111827; line-height: 1.3;
}
.cc-course-uni { font-size: 11.5px; color: #6b7280; margin: 0; }
.cc-value { font-size: 13px; color: #374151; font-weight: 500; }
.cc-badge-qual {
    padding: 4px 10px; border-radius: 9999px; font-size: 11px; font-weight: 700;
    display: inline-block; text-transform: uppercase; letter-spacing: 0.3px;
}
.cc-badge-intake {
    background: #fff; color: #374151; border: 1px solid #e5e7eb;
    padding: 4px 10px; border-radius: 9999px; font-size: 11px; font-weight: 500;
    margin-inline-end: 4px; margin-bottom: 4px; display: inline-block;
}
.cc-fee { font-size: 14px; font-weight: 800; color: #111827; }

/* Mobile horizontal scroll */
@media (max-width: 1024px) {
    .cc-export-wrapper { overflow-x: auto !important; }
    .cc-grid-chunk { min-width: 700px; }
}

/* ==========================================================================
   RTL (Arabic) overrides
   ========================================================================== */
[dir="rtl"] .cc-col-dismiss,
body.rtl .cc-col-dismiss,
html[lang="ar"] .cc-col-dismiss {
    right: auto;
    left: 10px;
}
[dir="rtl"] .cc-cell,
body.rtl .cc-cell,
html[lang="ar"] .cc-cell {
    text-align: right;
}
[dir="rtl"] .cc-course-header,
body.rtl .cc-course-header,
html[lang="ar"] .cc-course-header {
    align-items: flex-start; /* flex-start flips to the right in RTL */
}
[dir="rtl"] .cc-label-col,
body.rtl .cc-label-col,
html[lang="ar"] .cc-label-col {
    text-align: right;
}
[dir="rtl"] .cc-border-left,
body.rtl .cc-border-left,
html[lang="ar"] .cc-border-left {
    border-left: none;
    border-right: 1px solid #f3f4f6;
}

/* PDF/Print */
@media print {
    .cc-btn, .cc-col-dismiss, .cc-actions .cc-btn-close-popup { display: none !important; }
    #cc-custom-overlay {
        background: white !important; -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important; position: static !important;
        display: block !important; opacity: 1 !important;
    }
    .cc-modal-wrapper { max-height: none !important; overflow: visible !important; padding: 16px !important; box-shadow: none !important; }
    .cc-export-wrapper { overflow: visible !important; }
    .cc-grid-chunk, .cc-row, .cc-course-header, .cc-cell {
        break-inside: avoid !important; page-break-inside: avoid !important;
    }
}