:root {
    --primary-color: #3a9d61;
    --primary-dark: #2f804f;
    --text-color: #333;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
}

body {
    background-color: var(--bg-color);
    font-family: 'Cairo', sans-serif;
}

.checklist-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* padding-top: 80px; removed to prevent gap above sticky navbar */
    position: relative;

    background: no-repeat center center scroll;
    background-color: #e4e4e4;
    background-image: -webkit-linear-gradient(-405deg, #e4e4e4 0%, #fff 55%, #fff 100%, transparent);
    background-image: linear-gradient(135deg, #e4e4e4 0%, #fff 55%, #fff 100%, transparent);
}

.main-title {
    color: var(--primary-dark);
    font-weight: 800;
}

/* Navbar specific overrides */
.checklist-nav {
    background: #fff !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1030;
    /* Ensure it stays on top */
    position: sticky;
    top: 0;
}

.accordion-wrapper {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.domain-section {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    flex: 1 1 calc(50% - 12px);
    height: fit-content;
}
@media (max-width: 991px) {
    .domain-section {
        flex: 1 1 100%;
    }
}

.domain-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.domain-header {
    padding-top: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    user-select: none;
    background: #fff;
    position: relative;
}

/* Section Progress Bar */
.section-progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 2px;
    margin-top: 24px;
    overflow: hidden;
}

.section-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #2ecc71);
    border-radius: 2px;
    transition: width 0.4s ease;
    min-width: 0;
}

/* When section is 100% complete */
.section-progress-fill[style*='width: 100%'] {
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.5);
}

/* Remove cursor pointer in edit mode */
.edit-mode .domain-header {
    cursor: default;
}

.domain-title-group {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-inline-start: 20px;
}

.domain-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(40, 167, 69, 0.1);
    border-radius: 50%;
}

.domain-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-color);
}

.toggle-icon {
    color: #ccc;
    transition: transform 0.3s ease;
}

.domain-section.active .toggle-icon {
    transform: rotate(180deg);
    color: var(--primary-color);
}

/* Hide toggle icon in edit mode */
.edit-mode .toggle-icon {
    display: none;
}

.standards-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: #fff;
}

.standards-list-inner {
    padding: 10px 25px 30px 25px;
    border-top: 1px solid #f0f0f0;
}

.standard-item {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid #f9f9f9;
    padding: 15px 0;
}

.standard-item:last-child {
    border-bottom: none;
}

.standard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex-grow: 1;
}

/* Custom Checkbox */
.custom-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid #ccc;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: #fff;
    flex-shrink: 0;
}

.custom-checkbox.checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.standard-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #444;
}

.details-toggle {
    cursor: pointer;
    color: var(--primary-color);
    font-size: 1rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 10px;
    transition: background 0.2s;
}

.details-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.details-toggle i {
    font-weight: bold;
    transition: transform 0.3s ease;
}

.details-toggle.open i {
    transform: rotate(45deg);
    /* Simple way to make + into x, or rotate for effect if changing icon */
}

.standard-details {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    /* Light grey as in image */
    border-radius: 8px;
    font-size: 0.95rem;
    color: #555;
    display: none;
    /* border-right: 3px solid var(--primary-color); removed per image look, looks like full box */
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.03);
}

.standard-details-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.standard-details-header p {
    flex: 1;
}

/* Standard Options Dropdown */
.standard-options-dropdown {
    position: relative;
}

.standard-options-btn {
    background: transparent;
    padding: 5px;
    cursor: pointer;
    border-radius: 4px;
    color: #888;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none !important;
    border: none !important;
}

.standard-options-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #555;
}

.standard-options-menu {
    position: absolute;
    top: 100%;
    
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    padding: 5px;
    min-width: 150px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}
html[dir="rtl"] .standard-options-menu {
    left: 0;
}
html[dir="ltr"] .standard-options-menu {
    right: 0;
}

.standard-options-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(5px);
}

.standard-options-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: #555;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.standard-options-menu button:hover {
    background: #f8f9fa;
    color: #dc3545;
}

.standard-options-menu button i {
    font-size: 1.1rem;
}

.domain-progress {
    font-size: 0.9rem;
    color: #888;
    margin-inline-end: 15px;
    background: #eee;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Navbar tweaks to match index */
.bg-nav {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

footer {
    position: relative;
    z-index: 10;
    background: var(--bg-color);
    /* Ensure it's not transparent */
}

.bg-success {
    background-color: var(--primary-color) !important;
}

.text-success {
    color: var(--primary-color) !important;
}

/* ============================================
   CONTROLS & BUTTONS STYLING
   ============================================ */

.controls-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.controls-group-center {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

/* Base Button Styling */
.btn-expand-all,
.btn-mode-toggle,
.btn-reset {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Settings Button */
.btn-mode-toggle {
    /* background: linear-gradient(135deg, #3a9d61 0%, #2f804f 100%);
    color: white; */
}

.btn-mode-toggle:hover {
    /* transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(58, 157, 97, 0.4); */
}

.btn-mode-toggle.active {
    /* background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    animation: pulse 2s ease-in-out infinite; */
}

/* Reset Button */
.btn-reset {
    /* background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white; */
}

.btn-reset:hover {
    /* transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4); */
}

.btn-outline-primary:not(:disabled):not(.disabled).active,
.btn-outline-primary:not(:disabled):not(.disabled):active,
.show > .btn-outline-primary.dropdown-toggle {
    color: #2f804f;
    background-color: transparent;
    border-color: #2f804f;
}

/* Button Icons */
.btn-mode-toggle i,
.btn-reset i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.btn-mode-toggle:hover i {
    transform: rotate(90deg);
}

.btn-reset:hover i {
    transform: rotate(180deg);
}

/* Pulse Animation */
@keyframes pulse {
    0%,
    100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4);
    }
}

/* Ripple Effect */
.btn-expand-all::before,
.btn-mode-toggle::before,
.btn-reset::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition:
        width 0.6s,
        height 0.6s;
}

.btn-expand-all:active::before,
.btn-mode-toggle:active::before,
.btn-reset:active::before {
    width: 300px;
    height: 300px;
}

/* Responsive */
@media (max-width: 768px) {
    .controls-group {
        width: 100%;
        justify-content: center;
    }

    .btn-expand-all,
    .btn-mode-toggle,
    .btn-reset {
        flex: 1;
        justify-content: center;
        min-width: auto;
        font-size: 0.9rem;
        padding: 8px 16px;
    }

    .btn-expand-all span,
    .btn-mode-toggle span,
    .btn-reset span {
        display: none;
    }

    .btn-expand-all i,
    .btn-mode-toggle i,
    .btn-reset i {
        margin: 0;
    }
}

/* ============================================
   SETTINGS MENU & EDIT MODE
   ============================================ */

.settings-wrapper {
    position: relative;
    display: none;
    margin-left: 10px;
}

/* Show settings wrapper in edit mode */
.edit-mode .settings-wrapper {
    display: inline-flex;
}

.settings-btn {
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(58, 157, 97, 0.1);
}

.settings-btn:hover {
    background: rgba(58, 157, 97, 0.2);
    transform: scale(1.1);
}

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

.settings-btn svg path {
    stroke: var(--primary-color);
    transition: stroke 0.2s ease;
}

.settings-btn:hover svg path {
    stroke: var(--primary-dark);
}

/* Settings Menu Dropdown */
.settings-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.settings-option {
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: #555;
    border-bottom: 1px solid #f0f0f0;
}

.settings-option:last-child {
    border-bottom: none;
}

.settings-option:hover {
    background: #f8f9fa;
    color: var(--primary-color);
}

.settings-option i {
    font-size: 1.1rem;
}

/* Hidden Item Indicator */
.standard-item.hidden-item {
    opacity: 0.5;
    pointer-events: none;
}

/* Edit Mode Indicator */
.edit-mode .standard-item {
    border-left: 3px solid transparent;
    transition: border-color 0.2s ease;
}

.edit-mode .standard-item:hover {
    border-left-color: var(--primary-color);
}

/* Hide checkboxes in edit mode */
.edit-mode .custom-checkbox {
    display: none;
}

/* Hide details toggle in edit mode */
.edit-mode .details-toggle {
    display: none;
}

/* Show hide button in edit mode */
.hide-standard-btn {
    display: none;
}

.edit-mode .hide-standard-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
    outline: none;
    margin-inline: 8px;
}

.edit-mode .hide-standard-btn:hover {
    transform: translateY(-2px);
}

.edit-mode .hide-standard-btn i {
    font-size: 0.9rem;
}

/* Section Hide Button */
.section-hide-btn {
    display: none;
}

.edit-mode .section-hide-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-inline: 8px;
}

.edit-mode .section-hide-btn:hover {
    transform: translateY(-2px);
}

.edit-mode .section-hide-btn i {
    font-size: 0.85rem;
}

/* Checkbox Icons Row */
.checkbox-icons-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 24px;
    margin-top: 15px;
    margin-bottom: 25px;
    align-items: center;
    overflow-x: auto; /* Allow scrolling if too many icons on very small screens */
    padding-bottom: 5px;
}
@media (max-width: 768px) {
    .checkbox-icons-row {
        gap: 16px;
    }
}
.checkbox-icons-row picture {
    display: flex;
}

.checkbox-icons-row img {
    height: 32px; /* Base size for large */
    width: auto;
    object-fit: contain;
}

@media (max-width: 768px) {
    .checkbox-icons-row {
        gap: 5px;
        margin-bottom: 20px;
    }
    .checkbox-icons-row img {
        height: 25px; /* Smaller size for mobile */
    }
}

/* ============================================
   NEW SECTION SETTINGS DROPDOWN
   ============================================ */

.controls-wrapper {
    position: relative;
    /* padding-top: 20px; */
}

.section-settings-wrapper {
    position: absolute;
    top: 5px;
    z-index: 1000;
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 10px;
}

.section-settings-toggle {
    background: transparent;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #555;
    outline: none !important;
    border: none !important;
}

.section-settings-toggle:hover {
    color: var(--primary-color);
}

#reset-all-btn:hover {
    color: #e74c3c;
}

.section-settings-toggle i {
    font-size: 1.4rem;
}

.section-settings-menu {
    position: absolute;
    top: calc(100% + 10px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    min-width: 300px;
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid rgba(255,255,255,0.2);
}

.section-settings-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.section-menu-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-radius: 10px;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.section-menu-item:last-child {
    margin-bottom: 0;
}

.section-menu-item:hover {
    background: rgba(58, 157, 97, 0.05);
}

.section-menu-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    margin-inline-end: 14px;
    color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    flex-shrink: 0;
}

.section-menu-icon svg {
    width: 22px;
    height: 22px;
}

.section-menu-title {
    flex-grow: 1;
    font-size: 1rem;
    font-weight: 600;
    color: #444;
}

.section-hide-toggle {
    background: transparent;
    border: none;
    color: #b0b0b0;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 500;
    background: #f9f9f9;
    outline: none !important;
}

.section-hide-toggle:hover {
    background: #eee;
    color: #888;
}

.section-hide-toggle.is-hidden {
    color: var(--primary-color);
    background: rgba(58, 157, 97, 0.08);
}

.section-hide-toggle.is-hidden:hover {
    background: rgba(58, 157, 97, 0.15);
}

@media (max-width: 768px) {
    .section-settings-wrapper {
    }
    
    .section-settings-menu {
        /* min-width: 240px; */
    }
}
