/* Reset and Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

body {
    background-color: #ffffff;
    font-family: "Tahoma", "Verdana", sans-serif;
    font-size: 11px;
    color: #000;
    overflow: hidden;
}

/* Prevent Flash of Untranslated Content (FOUT) */
html.i18n-loading [data-en],
html.i18n-loading [data-en-title],
html.i18n-loading [data-en-alt],
html.i18n-loading .lang-en {
    visibility: hidden !important;
}

/* Hidden elements for different languages */
html[lang="fr"] .lang-en { display: none !important; }
html[lang="en"] .lang-fr { display: none !important; }

.main-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    height: 100%;
    background-color: #f6f6f6;
    border-right: 2px solid #919b9c;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.sidebar-header {
    background: linear-gradient(to bottom, #4a85f5 0%, #2662dd 12%, #1a4ab9 100%);
    color: white;
    padding: 5px 8px;
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 12px;
}

.header-icon {
    margin-right: 6px;
    display: flex;
    align-items: center;
}

.header-title {
    flex-grow: 1;
}

.close-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
    font-weight: bold;
}

/* Sidebar Toolbar */
.sidebar-toolbar {
    padding: 8px;
    border-bottom: 1px solid #d4d0c8;
    background-color: #ece9d8;
    display: flex;
    gap: 6px;
}

.toolbar-btn {
    padding: 3px 10px;
    background-color: #f0f0f0;
    border: 1px solid #808080;
    box-shadow: 1px 1px 0 #fff inset;
    cursor: default;
    font-family: inherit;
    font-size: 11px;
}

/* Favorites List */
.favorites-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px 0 180px 0;
}

details {
    user-select: none;
    margin-bottom: 2px;
}

summary {
    list-style: none;
    padding: 3px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    white-space: nowrap;
    transition: background 0.1s;
}

summary::-webkit-details-marker {
    display: none;
}

summary:hover {
    background-color: #e5f1fb;
}

.icon {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    flex-shrink: 0;
}

/* Sidebar Favorites Grid */
.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    /* Reduced from 15 */
    padding: 5px 10px;
    /* Reduced from 15 */
    background: transparent;
}

.nav-shortcut {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: #000;
    padding: 10px 5px;
    /* More padding */
    border: 1px solid transparent;
}

.nav-shortcut:hover {
    background: rgba(0, 102, 204, 0.1);
    border: 1px dotted #0066cc;
}

.nav-icon-box {
    position: relative;
    width: 40px;
    /* Reduced from 48 */
    height: 40px;
    margin-bottom: 6px;
}

.nav-favicon {
    width: 40px;
    /* Reduced from 48 */
    height: 40px;
    object-fit: contain;
}

.nav-arrow {
    position: absolute;
    bottom: -1px;
    left: -1px;
    width: 14px;
    /* Reduced from 16 */
    height: 14px;
    background: white;
    border: 1px solid #808080;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-arrow::after {
    content: "➔";
    color: blue;
    font-size: 8px;
    font-weight: bold;
}

.nav-label {
    font-size: 11px;
    /* Increased from 9px */
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: wrap;
    /* Let it wrap for readability */
    line-height: 1.2;
}

summary {
    font-size: 13px;
    /* Slightly larger category titles */
    font-weight: bold;
    color: #444;
}

.sub-list .note {
    font-size: 10px;
    color: #666;
    padding-left: 30px;
    padding-bottom: 5px;
    font-style: italic;
    max-width: 220px;
    white-space: normal;
}

/* Viewer Area */
.viewer-area {
    flex-grow: 1;
    background: #fff;
    position: relative;
    overflow: hidden;
}

.viewer-area iframe {
    width: 100%;
    height: 100%;
    border: none;
    transition: opacity 0.3s ease;
}