:root {
    --primary-color: #de9406;
    --secondary-color: #1e1e1e;
    --accent-color: #4895ef;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --sidebar-width: 70px;
    --sidebar-expanded-width: 220px;
}


.image-editor-container {
    display: flex;
    height: 100%;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    background-color: white;
    overflow: hidden;
}

/* Vertical Toolbar */
.editor-toolbar {
    width: var(--sidebar-width);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    transition: all 0.3s ease;
    padding: 15px 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Add this for vertical scrolling */
    overflow-x: hidden;
    /* Hide horizontal scroll */
    height: 100%;
    /* Take full height of parent */
}

.editor-toolbar::-webkit-scrollbar {
    width: 6px;
}

.editor-toolbar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.editor-toolbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.editor-toolbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ONLY expand with the 'expanded' class, not hover */
.editor-toolbar.expanded {
    width: var(--sidebar-expanded-width);
    overflow-x: visible;
}

/* Remove the hover effect that causes issues */
/* .editor-toolbar:hover {
            width: var(--sidebar-expanded-width);
            overflow-x: visible;
        } */

.toolbar-group {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
}

.toolbar-group:last-child {
    border-bottom: none;
}

.tool-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 15px;
    color: white;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

.tool-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.tool-btn i {
    font-size: 1.2rem;
    min-width: 30px;
    text-align: center;
    margin-right: 10px;
}

.tool-btn span {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Ensure span is visible when toolbar is expanded */
.editor-toolbar.expanded .tool-btn span {
    opacity: 1;
}

/* Remove the hover effect for span visibility */
/* .editor-toolbar:hover .tool-btn span {
            opacity: 1;
        } */


/* Main Content Area */
.editor-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    max-height: 90dvh;
    overflow: auto;
}

.editor-canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #FFF;
    border-radius: 8px;
    margin-bottom: 20px;
    position: relative;
    max-width: 100%;
}

#imageCanvas {
    max-width: none
    max-height: none;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

#defaultMessage {
    text-align: center;
    padding: 40px;
}

#defaultMessage img {
    max-width: 250px;
    opacity: 0.7;
    margin-bottom: 20px;
}

#defaultMessage h2 {
    color: #6c757d;
    margin-bottom: 10px;
}

#defaultMessage p {
    color: #adb5bd;
}

/* Controls Panel */
.controls-panel {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Controls Panel General Styling */
.controls-panel {
    padding: 15px;
    /* Smaller padding */
    margin-bottom: 15px;
    /* Smaller margin */
    background-color: #f0f4f8;
    /* A light, soft background */
    border: 1px solid #e0e6ed;
    /* Subtle border */
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    /* Slightly more prominent shadow */
}

.controls-panel h5 {
    font-size: 1rem;
    /* Smaller heading */
    margin-bottom: 10px;
    color: var(--primary-color);
    /* Use your primary color for headings */
    border-bottom: 1px solid rgba(var(--primary-color), 0.2);
    /* Subtle line below heading */
    padding-bottom: 5px;
}

/* Form Group Adjustments */
.controls-panel .form-group {
    margin-bottom: 10px;
    /* Reduced space between form groups */
}

.controls-panel label {
    font-size: 0.85rem;
    /* Smaller label text */
    color: #495057;
    /* Darker text for labels */
    margin-bottom: 3px;
    /* Closer to input */
}

/* Input/Select size adjustments */
.controls-panel .form-control,
.controls-panel .form-control-range,
.controls-panel .form-control-color {
    height: calc(1.8em + .75rem + 2px);
    /* Slightly smaller inputs */
    padding: .375rem .75rem;
    /* Adjust padding */
    font-size: 0.875rem;
    /* Smaller font in inputs */
    border-radius: .25rem;
    /* Standard rounded corners */
}

.controls-panel .form-control-color {
    width: 100%;
    /* Ensure full width */
    height: 38px;
    /* Fixed height for color picker */
}

/* Button Adjustments */
.controls-panel .btn {
    padding: .375rem .9rem;
    /* Smaller buttons */
    font-size: 0.875rem;
    /* Smaller font in buttons */
    border-radius: .25rem;
}

/* Specific Adjustments for form-row */
.controls-panel .form-row .form-group {
    margin-bottom: 0;
    /* Remove margin between items in a row */
}

/* Text stroke controls alignment */
#textControls .d-flex.align-items-center.mt-2 {
    margin-top: 5px !important;
    /* Adjust margin if needed */
}

#textControls input[type="number"] {
    max-width: 60px;
    /* Make stroke width input smaller */
}

/* Responsive Adjustments */
@media (max-width: 1150px) {
    body.no-image .controls-panel {
        display: none !important;
    }

    body.no-image .editor-canvas-container {
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    body.no-image #imageCanvas {
        display: none !important;
    }

    body.no-image #defaultMessage {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        height: 100%;
        width: 100%;
    }
}

.editor-toolbar .dropdown-menu.dropdown-adjustment-menu {
    position: absolute;
    top: 100%;
    left: 0;
    transform: translateY(4px);
    display: none;
    min-width: 220px;
    background-color: #fff;
    z-index: 9999;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 0;
}

.editor-toolbar .dropdown-menu.show {
    display: block;
}


.editor-toolbar .dropdown-item {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.custom-dropdown {
    position: relative;
}

.custom-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    display: none;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    z-index: 999;
    min-width: 200px;
    width: 100%;
    padding: 0;
}

.custom-dropdown-menu.show {
    display: block;
}

.custom-dropdown-menu .dropdown-item {
    padding: 8px 14px;
    font-size: 0.85rem;
    border-bottom: 1px solid #eee;
    background-color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.custom-dropdown-menu .dropdown-item:hover {
    background-color: #f1f1f1;
}
/* Thin scrollbar for the dropdown scrollable area */
.custom-dropdown-menu .dropdown-scrollable {
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;             /* Firefox */
  scrollbar-color: #ccc transparent; /* Firefox */
}

/* WebKit browsers (Chrome, Edge, etc.) */
.custom-dropdown-menu .dropdown-scrollable::-webkit-scrollbar {
  width: 6px;
}

.custom-dropdown-menu .dropdown-scrollable::-webkit-scrollbar-track {
  background: transparent;
}

.custom-dropdown-menu .dropdown-scrollable::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 4px;
}



/* Refined small control panels */
#resizeControls,
#borderControls,
#roundControls,
#textControls {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-left: 3px solid #de9406;
    border-radius: 8px 0 0 8px;
    padding: 15px;
    width: 280px;
    font-size: 0.85rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    z-index: 1050;
}

#resizeControls label,
#borderControls label,
#roundControls label,
#textControls label {
    font-weight: 500;
    font-size: 0.8rem;
    margin-bottom: 4px;
    color: #333;
}

#resizeControls input[type="range"],
#borderControls select,
#roundControls select,
#textControls select,
#textControls input[type="number"],
#textControls input[type="text"] {
    font-size: 0.85rem;
    padding: 0.375rem 0.5rem;
    border-radius: 5px;
}

#resizeControls input[type="number"],
#textControls input[type="number"] {
    max-width: 100%;
}

#resizeControls .form-control-sm,
#textControls .form-control-sm {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

#resizeControls .text-right,
#borderControls .d-flex,
#roundControls .d-flex,
#textControls .d-flex {
    margin-top: 10px;
}

#resizeControls .btn,
#borderControls .btn,
#roundControls .btn,
#textControls .btn {
    font-size: 0.75rem;
    padding: 4px 10px;
    background-color: #1e1e1e;
    color: #FFF;
}

#textControls .form-row .form-group,
#roundControls .form-group,
#borderControls .form-group {
    margin-bottom: 10px;
}

/* Text stroke input shrink */
#textStrokeColor {
    width: 45px;
    height: 32px;
    padding: 0;
}

/* Reduce control panel heading spacing */
#borderControls h5,
#roundControls h5,
#textControls h5 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--primary-color);
}

.editor-toolbar .dropdown-menu {
    min-width: 220px;
    width: 100%;
    background-color: #ffffff;
    padding: 0;
    border-radius: 6px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

/* Scrollable inner container */
.editor-toolbar .dropdown-scrollable {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.25rem 0;
}

/* Dropdown item style */
.editor-toolbar .dropdown-menu .dropdown-item {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Scroll-down indicator (arrow) */
.editor-toolbar .dropdown-scroll-indicator {
    text-align: center;
    padding: 2px 0;
    font-size: 0.8rem;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
    color: #999;
    position: absolute;
    bottom: 0;
    width: 100%;
    display: none;
    pointer-events: none;
}

.dropdown-menu.dropdown-adjustment-menu {
    min-width: 220px !important;
    max-width: 250px !important;
    width: 100% !important;
    max-height: 250px;
    overflow: hidden;
    padding: 0;
    background-color: #fff;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    z-index: 9999;
}

/* Inner scroll area */
.dropdown-adjustment-menu .dropdown-scrollable {
    max-height: 200px;
    overflow-y: hidden;
    padding: 0.25rem 0;
}

/* Dropdown items */
.dropdown-adjustment-menu .dropdown-item {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    white-space: nowrap;
}

/* Down-arrow indicator */
.dropdown-adjustment-menu .dropdown-scroll-indicator {
    text-align: center;
    font-size: 0.75rem;
    padding: 3px 0;
    background: linear-gradient(to top, #fff, transparent);
    color: #999;
    pointer-events: none;
    display: none;
}
@media (max-width: 576px) {
    /* Adjust toolbar for small screens */
    .editor-toolbar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 10px 5px;
        height: auto;
    }
    
    .editor-toolbar.expanded {
        width: 100%;
    }
    
    .toolbar-group {
        display: flex;
        margin-bottom: 0;
        margin-right: 10px;
        padding-bottom: 0;
        border-bottom: none;
        border-right: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .tool-btn {
        flex-direction: column;
        padding: 8px 10px;
        min-width: 60px;
        min-height: 60px;
        text-align: center;
    }
    
    .tool-btn i {
        margin-right: 0;
        margin-bottom: 5px;
    }
    
    
    
    /* Adjust dropdown menus */
    .custom-dropdown {
        position: static; /* Change from relative to static for mobile */
    }
    
    /* Make canvas area fit better */
    .editor-content {
        padding: 10px;
    }
    
    /* Hide default message image on very small screens */
    #defaultMessage img {
        max-width: 150px;
    }
    
    /* Adjust control panels */
    #resizeControls,
    #borderControls,
    #roundControls,
    #textControls {
        width: calc(100% - 20px);
        right: 10px;
        left: 10px;
        padding: 10px;
    }
    
    /* Make scrollbars thinner */
    .editor-toolbar::-webkit-scrollbar,
    .dropdown-scrollable::-webkit-scrollbar {
        height: 3px;
        width: 3px;
    }
    
    /* Adjust dropdown scrollable areas */
     .dropdown-scrollable {
        max-height: calc(50vh - 40px);
    }
    .custom-dropdown-menu.show {
        animation: slideUp 0.3s ease-out;
    }
    
    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    
    /* Hide scroll indicators on mobile */
    .dropdown-scroll-indicator {
        display: none !important;
    }
    
    /* Stack editor container vertically */
    .image-editor-container {
        flex-direction: column;
        height: auto;
    }
    
    .editor-canvas-container {
        min-height: 300px;
    }
     .form-control, .btn {
        padding: 10px 12px !important;
    }
    
    input[type="range"] {
        padding: 8px 0 !important;
    }
    
    /* Make dropdown items easier to tap */
    .dropdown-item {
        padding: 10px 15px !important;
    }
    .crop-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 100;
    }
    
    .crop-box {
        position: absolute;
        border: 2px dashed #fff;
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
        cursor: move;
    }
    
    .crop-handle {
        position: absolute;
        width: 20px;
        height: 20px;
        background: #fff;
        border: 2px solid #4361ee;
        border-radius: 50%;
        z-index: 101;
    }
    
    .crop-handle-tl { top: -10px; left: -10px; }
    .crop-handle-tr { top: -10px; right: -10px; }
    .crop-handle-bl { bottom: -10px; left: -10px; }
    .crop-handle-br { bottom: -10px; right: -10px; }
    
    /* Mobile-specific crop controls */
    
     .custom-dropdown-menu {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100% !important;
        max-height: 50vh;
        border-radius: 12px 12px 0 0;
        margin-top: 0;
        transform: none;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.2);
    }
}