body {
    margin: 0;
    padding: 0;
    background-color: #f0f2f5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
}

header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    display: flex;
    align-items: center;
    padding: 0 12px;
}


.theme-selector-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    padding: 6px 16px;
    background-color: #f8f9fa;
    border-radius: 20px;
    border: 1px solid #ddd;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
    justify-content: space-between;
    box-sizing: border-box;
    height: 38px;
    min-width: 180px;
}
.theme-selector-wrapper:hover {
    border-color: #0078d4;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.theme-icon {
    font-size: 1.1em;
}
.dropdown-arrow {
    font-size: 0.8em;
    color: grey;
    transition: transform 0.3s ease;
}
.theme-selector-wrapper.open .dropdown-arrow {
    transform: rotate(180deg);
}

.theme-options-container {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 160px;
    display: none; /* Hidden by default */
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
    max-height: 480px; 
    overflow-y: auto;
}
.theme-options-container::-webkit-scrollbar {
    width: 6px;
}

.theme-selector-wrapper.open .theme-options-container {
    display: flex;
    animation: fadeInDown 0.2s ease;
}
.theme-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    display: flex;
    gap: 10px;
}
.theme-option:hover {
    background: #f0f6ff;
    color: #0078d4;
}
.theme-option.selected {
    background: #e6f2ff;
    color: #0078d4;
    font-weight: 600;
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

#tabs-container {
    display: flex;
    margin: 0 auto;
}

.tab-button {
    padding: 15px 20px;
    background-color: transparent;
    cursor: pointer;
    font-size: 1em;
    text-transform: uppercase;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}
.tab-button.active {
    font-weight: 600;
    border-bottom-color: #0078d4;
}

#tab-panels-container {
    width: 85%;
    margin: 0 auto;
    padding: 40px;
}
.tab-panel {
    display: none;
    flex-direction: column;
    gap: 60px;
}
.tab-panel.active {
    display: flex;
}

.folder-group {
    border-radius: 8px;
    padding: 15px;
    height: fit-content;
    background-color: #fdfdfd;
    border: 1px dashed #ccc;
}

.folder-title {
    position: relative;
    font-size: 1.5em;
    font-weight: 400;
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #eeeeee70;
    color: #333;
    cursor: pointer;
    user-select: none;
    padding-right: 20px; /* Make space for the icon */
}
.folder-title::after {
    content: '−';
    position: absolute;
    right: 0;
    font-weight: bold;
    color: #888;
}
.collapsed > .folder-title {
    margin-bottom: 0;
    border-bottom: none;
}
.collapsed > .folder-title::after {
    content: '+';
}
.folder-block>.folder-title {
    font-weight: 500;
}

.folder-block>.folder-items {
    padding-left: 20px;
}
.folder-items {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 20px;
}
.collapsed > .folder-items {
    display: none;
}

.card {
    min-width: 160px;
    padding: 10px;
    background-color: rgba(var(--icon-color), 0.2);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
    background-color: rgba(var(--icon-color), 0.3);
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-icon {
    width: 24px;
    height: 24px;
}

.card-title {
    font-weight: 500;
    font-size: 1em;
}


/* =========================================
   Context Menu Styles
   ========================================= */
.context-menu {
    display: none;
    position: absolute;
    z-index: 9999;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 8px 0;
    min-width: 170px;
}
.context-menu.active {
    display: block;
}

.cm-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #333333;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.1s;
}
.cm-item:hover {
    background-color: #f0f0f0;
}
.cm-item.cm-danger {
    color: #d32f2f;
    border-top: 1px solid #eeeeee;
    margin-top: 4px;
    padding-top: 12px;
}

/* =========================================
   Drag & Drop Styles
   ========================================= */
.card, .folder-group, .folder-block {
    cursor: grab;
}
.card>img, .card>div {
    cursor: pointer;
}
.card:active, .folder-group:active, .folder-block:active {
    cursor: grabbing;
}
.card.dragging, .folder-group.dragging, .folder-block.dragging {
    opacity: 0.5;
    transform: scale(0.95);
    box-shadow: none;
    cursor: grabbing;
}

.folder-items {
    min-height: 20px; 
    transition: background-color 0.2s ease, border 0.2s ease;
    position: relative; /* For the drag indicator */
}
/* Highlight visual feedback when a card hovers over a folder */
.folder-items.drag-over, .tab-panel.drag-over {
    background-color: rgba(0, 120, 212, 0.05);
    border: 1px dashed #0078d4;
    border-radius: 8px;
}

.drag-indicator {
    width: 4px;
    min-height: 32px;
    background-color: #0078d4;
    border-radius: 2px;
    margin: 0 -12px; /* Pulls it perfectly into the 20px gap between cards */
    z-index: 10;
    pointer-events: none; /* Prevents it from interfering with mouse events */
    transition: transform 0.1s ease;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: 20px;
}
#search-input {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #ccc;
    background-color: transparent; /* Transparent helps it blend into different themes automatically */
    color: inherit;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    width: 220px;
    box-sizing: border-box;
    height: 38px;
}
#search-input:focus {
    border-color: #0078d4;
    box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}
body.is-searching .tab-button {
    opacity: 0.5;
    pointer-events: none; /* Disable tab switching while searching */
}
body.is-searching .folder-group.collapsed > .folder-items,
body.is-searching .folder-block.collapsed > .folder-items {
    display: flex; 
}
body.is-searching .folder-title,
body.is-searching .card,
body.is-searching .folder-group,
body.is-searching .card:active, 
body.is-searching .folder-group:active {
    cursor: default;
}
body.is-searching .folder-title::after {
    display: none;
}

.search-status-pill {
    display: none; /* Hidden by default */
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    border-radius: 30px;
    font-weight: 500;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    pointer-events: none; /* Ensures it doesn't block clicks on cards underneath it */
    text-align: center;
    font-size: 1em;

    background-color: rgba(30, 30, 30, 0.85);
    color: #ffffff;
    box-shadow: 0 4px 20px rgb(158 158 158 / 60%);
}

body.is-searching .search-status-pill {
    display: block;
    animation: popUpFade 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popUpFade {
    from { 
        opacity: 0; 
        transform: translate(-50%, 20px) scale(0.9); 
    }
    to { 
        opacity: 1; 
        transform: translate(-50%, 0) scale(1); 
    }
}


.overflow-menu-wrapper {
    position: relative; /* Essential for dropdown positioning */
    display: flex;
    align-items: center;
}

#overflow-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #666; 
    padding: 8px; /* Slightly more padding for a better click target */
    margin-left: 5px;
    transition: all 0.2s ease; /* Animate all properties smoothly */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%; /* Ensures the hover background is a perfect circle */
}
#overflow-btn:hover {
    background-color: #f0f6ff; /* A soft light blue background */
    color: #0078d4; /* Changes the icon color to your primary blue */
    transform: translateY(-1px); /* Slight lift effect */
    box-shadow: 0 2px 5px rgba(0, 120, 212, 0.15); /* Soft blue shadow */
}
#overflow-btn:active {
    transform: translateY(0) scale(0.95); /* Nice 'click' press effect */
    box-shadow: none;
}
#overflow-btn svg {
    display: block;
}

.overflow-options-container {
    display: none; /* Initially hidden */
    position: absolute;
    top: 100%; /* Positions below the button */
    right: 0;
    margin-top: 5px;
    background-color: #fff; /* Fixed: Solid white background */
    border: 1px solid #eee; /* Fixed: Light grey border */
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12); /* Matched to theme dropdown */
    z-index: 1001; /* Above all other elements */
    min-width: 161px;
    padding: 8px 0;
    overflow: hidden; /* Ensures radius works on items */
}
.overflow-options-container.show {
    display: flex;
    flex-direction: column;
}

.overflow-item {
    display: flex;
    align-items: stretch;
    text-decoration: none;
    color: var(--text-color);
    padding: 10px 16px;
    font-size: 1.1em;
    transition: background-color 0.2s, color 0.2s;
    cursor: pointer;
}
.overflow-item:hover {
    background-color: #f0f6ff; /* Fixed: Nice light blue hover */
    color: #0078d4; /* Fixed: Matched to theme dropdown hover text */
}
.overflow-item .menu-icon {
    margin-right: 12px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px; /* Fixed width for better alignment */
}

.menu-bmac-img {
    height: 20px;
    width: auto;
    border-radius: 4px;
}