/* css/components.css */

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Modal Containers */
.reorder-list-container {
    max-height: 50vh;
    overflow-y: auto;
}

.gallery-grid {
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); 
    gap: var(--space-sm); 
    max-height: 50vh; 
    overflow-y: auto;
}

.reorder-item {
    display: flex; 
    justify-content: flex-start; 
    align-items: center; 
    background: #f0f0f0; 
    padding: var(--space-sm); 
    border-radius: var(--space-xs); 
    cursor: grab;
    color: var(--color-text);
}

.modal-content {
    background: var(--color-bg);
    color: var(--color-text); /* Force dark text regardless of body theme */
    padding: var(--space-lg);
    border-radius: var(--space-sm);
    box-shadow: 0 var(--space-xs) var(--space-lg) rgba(0,0,0,0.5);
    min-width: 300px;
    width: 90%;
    max-width: 600px; /* default max width */
}
.modal-sm { max-width: 400px; }
.modal-md { max-width: 500px; }
.modal-lg { max-width: 800px; }
.modal-content h2 {
    margin-bottom: var(--space-md);
    color: var(--color-secondary);
}
.modal-content input[type="text"], .modal-content input[type="password"] {
    width: 100%;
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
    border-radius: var(--space-xs);
    border: 1px solid #ccc;
    font-size: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.5rem var(--font-md);
    cursor: pointer;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    color: var(--color-text);
    font-size: 0.875rem;
    box-sizing: border-box;
    text-decoration: none;
}
.btn:hover {
    background: #f0f0f0;
}

.btn-primary, .btn-secondary {
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--space-xs);
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}
.btn-primary { background: var(--color-secondary); color: white; }
.btn-primary:hover { background: #d90429; }

.btn-icon {
    width: auto !important;
    padding: var(--space-sm) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon .material-symbols-outlined { margin: 0; }

.btn-secondary {
    background-color: #ccc;
    color: black;
    border: 1px solid #aaa;
}

.btn-secondary:hover {
    background-color: #bbb;
}

.btn-muted {
    background-color: var(--color-muted);
    color: var(--raf-white);
    border: none;
}

.btn-muted:hover {
    background-color: #555555;
    transform: translateY(-2px);
    box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.15);
}

/* --- Shared Navigation Frosted Glass Styles --- */
.menu-btn,
.expandable-menu,
.hamburger-trigger,
.hamburger-items > * {
    background: rgba(0, 47, 95, 0.45) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.15) !important;
    color: #FFFFFF !important;
}
.menu-btn:hover, .menu-btn:active,
.expandable-menu:hover,
.expandable-menu:focus-within,
.hamburger-items > *:hover {
    background: rgba(0, 47, 95, 0.85) !important;
    transform: translateY(-2px) !important;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.5), 0 4px 10px rgba(0,0,0,0.2), 0 0 10px rgba(255,255,255,0.5) !important;
    border: 1px solid rgba(255,255,255,0.9) !important;
}

/* Menu Buttons (Circular) */
.menu-btn {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

/* Button Group (used in pagination and toolbars) */
.btn-group { display: inline-flex; }
.btn-group button {
    margin: 0 !important;
    border-radius: 0;
    border-right: none;
    background: #fff;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs) var(--space-sm);
}
.btn-group button:hover { background: #e0e0e0; }
.btn-group button:first-child { border-top-left-radius: 0.25rem; border-bottom-left-radius: 0.25rem; }
.btn-group button:last-child { border-top-right-radius: 0.25rem; border-bottom-right-radius: 0.25rem; border-right: 1px solid #ccc; }
.btn-group button:disabled, .btn-group button:disabled:hover { 
    background: #f9f9f9; 
    color: #ccc; 
    cursor: not-allowed; 
    opacity: 0.6;
}

/* Pagination Info */
.pagination-info {
    padding: var(--space-xs) var(--space-md);
    background: #fff;
    color: var(--color-text);
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    border-left: 1px solid #ccc;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.gallery-img-container {
    border-radius: var(--space-xs); 
    overflow: hidden; 
    height: 150px; 
    cursor: pointer;
}
.gallery-img-item {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--space-xs);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.gallery-img-item:hover {
    transform: scale(1.05);
    box-shadow: 0 var(--space-xs) var(--space-md) rgba(0,0,0,0.5);
}

/* Tag Input Styles */
.tag-pill {
    display: inline-flex;
    align-items: center;
    background-color: #b3c6df;
    border: 1px solid #7a9cc6;
    color: var(--color-text);
    padding: 2px 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    gap: var(--space-xs);
}
.tag-pill .remove-tag {
    cursor: pointer;
    font-weight: bold;
    color: #555;
}
.tag-pill .remove-tag:hover {
    color: #000;
}
.autocomplete-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}
.autocomplete-item:hover, .autocomplete-item.selected {
    background-color: #f0f0f0;
}

/* Filter Tags */
.filter-tag {
    display: inline-flex;
    align-items: center;
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    color: #555;
    padding: 6px 0.75rem;
    border-radius: var(--space-lg);
    font-size: 0.875rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    user-select: none;
}
.filter-tag:hover {
    background-color: #e0e0e0;
}
.filter-tag.active {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    font-weight: bold;
}

/* Bottom Right Controls Container */
#bottom-right-controls {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-sm);
    z-index: 1000; /* High z-index to stay above content */
}


/* Expandable Menu Component */
.expandable-menu {
    --menu-collapsed-width: 50px;
    
    position: relative;
    height: 50px;
    width: var(--menu-collapsed-width);
    border-radius: 25px;
    overflow: hidden;
    transition: all 0.3s ease;
    outline: none;
}
.expandable-menu:hover,
.expandable-menu:focus-within {
    width: max-content;
}

.expandable-menu-trigger {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--menu-collapsed-width);
    height: 50px;
    color: var(--nav-btn-icon-color, white);
    transition: opacity 0.3s;
    cursor: pointer;
    z-index: 10;
}
.expandable-menu-trigger span { font-size: 30px; }

.expandable-menu:hover .expandable-menu-trigger,
.expandable-menu:focus-within .expandable-menu-trigger {
    opacity: 0;
    pointer-events: none;
}

.expandable-menu-items {
    display: flex;
    flex-direction: row;
    height: 50px;
    width: max-content;
    opacity: 0;
    transition: opacity 0.3s;
}
.expandable-menu:hover .expandable-menu-items,
.expandable-menu:focus-within .expandable-menu-items {
    opacity: 1;
}

.expandable-menu-items button {
    background: transparent;
    color: var(--nav-btn-icon-color, white);
    border: none;
    border-right: 1px solid rgba(255,255,255,0.2);
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}
.expandable-menu-items button:last-child {
    border-right: none;
}
.expandable-menu-items button:hover {
    background: var(--nav-item-hover-bg, rgba(255,255,255,0.2));
    color: var(--nav-btn-icon-color-hover, var(--nav-btn-icon-color, white));
}
.expandable-menu-items button span { font-size: 30px; }


/* Page Header Swoosh */
.page-header-swoosh {
    height: 120px;
    width: 100%;
    position: relative;
    color: white;
    background-color: var(--raf-supp-4);
    z-index: 1;
}

.page-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    height: 100%;
    z-index: 2;
}

@media screen and (max-width: 1120px) {
    .page-header-content {
        padding-right: 80px; /* Prevent overlap with the fixed top-right menu */
    }
}

.header-swoosh-svg {
    position: absolute;
    bottom: -60px;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: -1;
    transform: scaleX(-1);
}

.page-header-swoosh h1 {
    margin: 0;
    font-size: 2.8rem;
    z-index: 2;
}

.page-header-swoosh h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 2;
}

.header-titles {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 2;
    flex: 1;
}

.page-header-swoosh img {
    height: 80px;
    z-index: 2;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

@media print {
    .page-header-swoosh {
        position: fixed;
        top: 0;
        left: -20mm; /* Push into left page margin */
        width: calc(100% + 40mm); /* Span entire page width */
        z-index: 1000;
        height: 120px;
        display: flex !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        padding-left: calc(var(--space-lg) + 20mm) !important; /* Keep text aligned to original margin */
        padding-right: calc(var(--space-lg) + 20mm) !important; /* Keep logo aligned to original margin */
    }

    .page-header-swoosh img {
        margin-right: 0 !important;
    }
}

/* Focus Target Button */
.focus-target-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}
.gallery-img-container:hover .focus-target-btn {
    opacity: 1;
}
.focus-target-btn:hover {
    background: var(--raf-red);
}

/* Toast Container */
#global-toast-container {
    position: fixed;
    bottom: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--space-lg);
    font-size: 1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 9999;
}

#global-toast-container.show {
    opacity: 1;
}

#global-toast-container.success {
    background: var(--raf-supp-2, #879637);
}

#global-toast-container.error {
    background: var(--raf-logo-1, #C60C30);
}

#global-toast-container.info {
    background: var(--raf-nav-2, #5482AB);
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* Hamburger Menu (Vertical Expandable) */
.hamburger-menu { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 50px; width: 50px; border-radius: 25px; background: transparent; transition: height 0.3s ease; overflow: hidden; outline: none; }
.hamburger-menu:hover, .hamburger-menu:focus-within { height: 450px; background: transparent; overflow: visible; }
.hamburger-trigger { 
    position: absolute; bottom: 0; width: 50px; height: 50px; cursor: pointer; transition: all 0.3s; z-index: 10; display: flex; align-items: center; justify-content: center; border-radius: 25px; 
}
.hamburger-trigger span { font-size: 30px; }
.hamburger-menu:hover .hamburger-trigger, .hamburger-menu:focus-within .hamburger-trigger { opacity: 0; pointer-events: none; }
.hamburger-items { display: flex; flex-direction: column-reverse; pointer-events: none; padding-bottom: 50px; width: 100%; align-items: center; }
.hamburger-menu:hover .hamburger-items, .hamburger-menu:focus-within .hamburger-items { pointer-events: auto; }
.hamburger-items > * { 
    margin: 0; text-decoration: none; width: 50px; height: 50px; display: flex; justify-content: center; align-items: center; border-radius: 25px; opacity: 0; transform: translateY(20px); transition: all 0.2s ease; margin-bottom: 4px; 
}
.hamburger-menu:hover .hamburger-items > * { opacity: 1; transform: translateY(0); }

/* Staggered transition delays for "expanding" effect using modern CSS */
.hamburger-items {
    --delay: 0.04s;
}
.hamburger-items > * {
    transition-delay: calc((sibling-index() - 1) * var(--delay));
}


/* Bottom Right Controls Container */
#bottom-right-controls {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-sm);
    z-index: 1000;
}


/* Top Right User Controls */
#top-right-controls {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 1000;
}

.user-dropdown {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    outline: none;
    padding-bottom: 20px;
}

.user-trigger {
    background: var(--nav-btn-bg, rgba(0,0,0,0.3));
    color: var(--nav-btn-icon-color, white);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s, opacity 0.3s;
    opacity: var(--nav-btn-opacity, 0.3);
}
.user-dropdown:hover .user-trigger,
.user-dropdown:focus-within .user-trigger {
    background: var(--nav-btn-hover-bg, rgba(0,0,0,0.7));
    opacity: var(--nav-btn-hover-opacity, 1);
}
.user-trigger span { font-size: 30px; }

.user-dropdown-items {
    position: absolute;
    top: 60px;
    right: 0;
    display: flex;
    flex-direction: column;
    background: var(--nav-btn-hover-bg, rgba(0,0,0,0.7));
    border-radius: var(--space-sm);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    min-width: 150px;
}
.user-dropdown-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: var(--space-sm);
    font-weight: bold;
    color: var(--nav-btn-icon-color, white);
    font-size: var(--font-lg);
    text-align: center;
}
.rank-picker-popover {
    margin: 0;
    bottom: anchor(top);
    left: anchor(center);
    transform: translateX(-50%);
    margin-bottom: var(--space-xs);
}
.user-dropdown:hover .user-dropdown-items,
.user-dropdown:focus-within .user-dropdown-items {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.user-dropdown-btn {
    background: transparent;
    color: var(--nav-btn-icon-color, white);
    border: none;
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    transition: background 0.2s;
    text-decoration: none;
    font-size: 1rem;
    font-family: inherit;
}
.user-dropdown-btn:hover {
    background: var(--nav-item-hover-bg, rgba(255,255,255,0.2));
    color: var(--nav-btn-icon-color-hover, var(--nav-btn-icon-color, white));
}
.center {
    text-align: center;
}
.w-auto {
    width: auto !important;
}
.d-block {
    display: block !important;
}

/* Common Inline Style Replacements */
.flex-space-between-center {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.m-0 { margin: 0 !important; }
.mb-xs { margin-bottom: 0.5rem !important; }
.mb-sm { margin-bottom: 1rem !important; }
.mb-md { margin-bottom: 1.5rem !important; }

.btn-close-editor {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
}
.sidebar-tab-content {
    display: flex;
    flex-direction: column;
    height: calc(100% - 2.5rem);
}
.settings-form-wrapper {
    margin-top: 1rem;
    flex: 1;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}
.flex-shrink-0 { flex-shrink: 0; }
.flex-grow-1-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.bg-list-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 0.625rem;
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}
.btn-sm {
    width: auto;
    margin: 0;
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}
.icon-sm { font-size: 1rem; }
.w-100 { width: 100% !important; }
.gallery-item-wrapper {
    position: relative;
    cursor: pointer;
}
.gallery-item-img {
    width: 100%;
    height: 7.5rem;
    object-fit: cover;
    border-radius: 0.25rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.2);
}
.qr-svg-wrapper {
    max-width: 400px;
    width: 100%;
    aspect-ratio: 1;
    background: transparent;
}
.reorder-item-flex-start {
    justify-content: flex-start;
}
.icon-muted {
    color: #888;
    font-size: 1.125rem;
}
.position-relative {
    position: relative;
}
.font-size-20 {
    font-size: 20px;
}
.ml-md {
    margin-left: 1rem !important;
}
.flex-align-center {
    display: flex;
    align-items: center;
}
.vertical-align-middle {
    vertical-align: middle;
}
.flex-justify-end {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
.text-center { text-align: center; }
.margin-bottom-md { margin-bottom: 1.25rem; }
.margin-bottom-sm { margin-bottom: 0.5rem; }
.margin-bottom-lg { margin-bottom: 1rem; }
.text-error-red { color: red; }
.text-success-green { color: green; }
.text-info-blue { color: blue; }
.border-box { box-sizing: border-box; }
.focus-preview-container {
    position: relative;
    display: block;
    margin: 0 auto;
    width: max-content;
    max-width: 100%;
    cursor: crosshair;
    border: 1px solid var(--color-muted);
}
.focus-preview-img {
    display: block;
    max-width: 100%;
    max-height: 50vh;
    width: auto;
    height: auto;
}
.focus-reticle {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--raf-red);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 0 0 2px white;
}
.border-bottom-black {
    border-bottom: 0.0625rem solid #000;
}
