:root {
    --primary-color: #EE786D;
    --bg-color: #1C1C1C;
    --card-bg: #242424;
    --text-color: #F5F5F5;
    --text-secondary: #808080;
    --text-muted: #808080;
    --border-color: #333333;
    --sidebar-bg: #1C1C1C;
    --sidebar-active-bg: rgba(238, 120, 109, 0.1);
    --input-bg: #242424;
    --header-bg: #1C1C1C;
    --toolbar-bg: #1C1C1C;
    --item-hover-bg: rgba(255, 255, 255, 0.05);

    /* Status Colors */
    --status-pending-bg: rgba(51, 65, 85, 0.2);
    --status-pending-text: #94a3b8;
    --status-processing-bg: rgba(245, 158, 11, 0.2);
    --status-processing-text: #f59e0b;
    --status-completed-bg: rgba(16, 185, 129, 0.2);
    --status-completed-text: #10b981;
    --status-failed-bg: rgba(239, 68, 68, 0.2);
    --status-failed-text: #ef4444;

    --icon-filter: invert(100%) sepia(100%) saturate(0%) hue-rotate(288deg) brightness(102%) contrast(102%);
    --annotation-stroke-width: 3px;
}

/* Theme Overrides */
/* Dark mode is now the default theme in :root */

.theme-olive {
    --primary-color: #606c38;
    --bg-color: #f2f4ef;
    --text-color: #283618;
    --text-secondary: #606c38;
    --border-color: #dde5d7;
    --white: #ffffff;
    --sidebar-bg: #283618;
}

.theme-pink {
    --primary-color: #db2777;
    --bg-color: #fff1f2;
    --text-color: #4c0519;
    --text-secondary: #be185d;
    --border-color: #fecdd3;
    --white: #ffffff;
    --sidebar-bg: #4c0519;
}

/* ── Global scrollbar styling ── */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--card-bg);
}
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--card-bg);
}
::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #f09088;
}

/* Common styles for drawing annotations and markers */
.drawing-overlay polyline,
.drawing-overlay rect,
.drawing-overlay circle,
.drawing-overlay line,
.drawing-overlay path {
    fill: none;
    stroke-width: var(--annotation-stroke-width);
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.marker {
    position: absolute;
    width: 20px;
    height: 20px;
    border: var(--annotation-stroke-width) solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    z-index: 10;
    transition: transform 0.1s;
}

.marker:hover,
.marker.active {
    transform: translate(-50%, -50%) scale(1.4);
    z-index: 11;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Dark body for all arq- pages (every page that uses the sidebar layout) */
body:has(.arq-layout) {
    background: #111111;
    color: #f1f5f9;
    overflow: hidden;
    height: 100vh;
}

ul.menu {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.main-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    border-radius: 10px;
    padding: 0px;
    margin: 0px;
}

.main-content {
    padding: 5px;
}

.left-column {
    flex: 1;
}

.right-column {
    flex-grow: 10;
}


/* Modern Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 20px;
    height: 100vh;
    box-sizing: border-box;
    position: sticky;
    top: 0;
}

.project-selector-wrapper {
    margin-top: 10px;
    margin-bottom: 40px;
}

.project-selector-container label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--sidebar-text);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

/* Custom Select Styles */
.custom-select {
    position: relative;
    width: 100%;
    margin-top: 5px;
}

.custom-select-trigger {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
    box-sizing: border-box;
}

.custom-select-trigger:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.08);
}

.custom-select.active .custom-select-trigger {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.custom-select .arrow {
    transition: transform 0.2s;
    opacity: 0.7;
}

.custom-select.active .arrow {
    transform: rotate(180deg);
}

.custom-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background-color: #1e1e32;
    /* Solid dark background for robust visibility */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: none;
    z-index: 2000;
    max-height: 300px;
    overflow-y: auto;
}

.custom-select.active .custom-options {
    display: block;
}

.custom-option {
    padding: 10px 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: background-color 0.2s;
}

.custom-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.custom-option.selected {
    background-color: var(--primary-color);
    color: white;
}

.custom-option.placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

.sidebar-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.sidebar-section-title {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--sidebar-text);
    margin: 24px 0 12px 0;
    letter-spacing: 0.05em;
}

.sidebar nav a {
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 14px;
    border-radius: 6px;
    margin-bottom: 4px;
}

.sidebar nav a:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar nav a.active {
    color: white;
    background-color: var(--sidebar-active-bg);
}

.sidebar nav a svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    stroke: currentColor;
}

.sidebar nav a.active svg {
    opacity: 1;
}

/* Hide project items if no project selected */
.project-only {
    display: none;
}

.project-selected .project-only {
    display: flex;
}

.oauth-buttons {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.oauth-btn {
    display: block;
    width: 100%;
    padding: 0.75rem;
    text-align: center;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    color: white;
    box-sizing: border-box;
}

.oauth-btn.google {
    background-color: #db4437;
}

.oauth-btn.facebook {
    background-color: #4267B2;
}

.oauth-btn:hover {
    opacity: 0.9;
}

#menu {
    height: 100%;
}

/* Global Header */
.global-header {
    height: 60px;
    background-color: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.global-header .header-logo img {
    width: 50%;
    height: auto;
}

.user-profile-container {
    position: relative;
    user-select: none;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 30px;
    transition: background-color 0.2s;
}

.user-profile:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.avatar-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--white);
    box-shadow: 0 0 0 1px var(--border-color);
}

.dropdown-arrow {
    font-size: 10px;
    color: var(--text-secondary);
}

/* Dropdown Menu */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 250px;
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 0.2s ease-out;
    border: 1px solid var(--border-color);
}

.profile-dropdown.active {
    display: flex;
}

.dropdown-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.dropdown-header .avatar-img {
    width: 45px;
    height: 45px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info .user-name {
    font-weight: 600;
    color: var(--text-color);
    font-size: 15px;
}

.user-info .user-email {
    font-size: 13px;
    color: var(--text-secondary);
    word-break: break-all;
}

.profile-dropdown hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0;
}

.dropdown-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: var(--item-hover-bg);
}

.dropdown-item .icon {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
}

.dropdown-item.logout {
    color: var(--primary-color);
    opacity: 0.8;
}

.dropdown-item.logout:hover {
    background-color: var(--item-hover-bg);
    opacity: 1;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Project Horizontal Navbar */
.project-navbar {
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 0 40px;
    height: 50px;
    display: flex;
    align-items: center;
    position: sticky;
    z-index: 990;
}

.project-navbar-content {
    display: flex;
    gap: 30px;
    height: 100%;
}

.project-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 0 4px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    height: 100%;
    box-sizing: border-box;
    cursor: pointer;
}

.project-nav-item:hover {
    color: var(--primary-color);
}

.project-nav-item.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.project-nav-item svg {
    width: 18px;
    height: 18px;
}

/* ── arq- Sidebar (shared across all pages) ─────────────────── */
.arq-sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.arq-sidebar.collapsed {
    width: 72px;
}

.arq-logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    height: 80px;
    box-sizing: border-box;
}

.arq-sidebar.collapsed .arq-logo-area {
    padding: 24px 5px;
    justify-content: space-between;
}

.arq-logo-icon {
    width: 34px;
    height: 34px;
    background: var(--primary-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    color: #1a1a1a;
    font-family: monospace;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.arq-logo-text { 
    display: flex; 
    flex-direction: column;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.arq-sidebar.collapsed .arq-logo-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    position: absolute;
}

.arq-brand { font-size: 15px; font-weight: 700; color: var(--text-color); letter-spacing: 0.05em; line-height: 1.2; }
.arq-tagline { font-size: 9px; color: var(--text-secondary); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }

.arq-sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.3s;
    margin-left: auto;
    border-radius: 4px;
}

.arq-sidebar.collapsed .arq-sidebar-toggle {
    margin-left: 0;
    position: static;
}

.arq-sidebar-toggle:hover {
    color: var(--text-color);
}

.arq-sidebar.collapsed .chevron-icon {
    transform: rotate(180deg);
}

.arq-client-label {
    margin: 12px 14px 4px;
    padding: 7px 12px;
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
    transition: color 0.3s, border-color 0.3s, background 0.3s;
}

.arq-sidebar.collapsed .arq-client-label {
    justify-content: center;
    margin: 12px 8px 4px;
    padding: 7px 0;
}
.arq-sidebar.collapsed .arq-client-label .label-text {
    display: none;
}

.arq-sidebar.collapsed .label-text {
    display: none;
}

.arq-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 4px 0;
}

.arq-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
    border-left: 3px solid transparent;
    position: relative;
    white-space: nowrap;
}

.arq-sidebar.collapsed .arq-nav-item {
    padding: 12px 0;
    justify-content: center;
    border-left-width: 4px;
}

.arq-sidebar.collapsed .nav-text {
    display: none;
}

.arq-nav-item:hover {
    color: var(--text-color);
    background: var(--item-hover-bg);
}

.arq-nav-item.active {
    color: var(--text-color);
    border-left-color: var(--primary-color);
    background: rgba(238, 120, 109, 0.08);
}

.arq-nav-item svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    flex-shrink: 0;
}

.arq-user-area {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    height: 64px;
    box-sizing: border-box;
    transition: all 0.3s;
}

.arq-sidebar.collapsed .arq-user-area {
    padding: 16px 0;
    justify-content: center;
}

.arq-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #7c3aed;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}

.arq-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.arq-user-details { 
    flex: 1; 
    min-width: 0;
    transition: opacity 0.2s;
}

.arq-sidebar.collapsed .arq-user-details {
    display: none;
}

.arq-user-name-text { display: block; font-size: 12px; font-weight: 600; color: var(--text-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arq-user-email-text { display: block; font-size: 10px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.arq-logout-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    transition: color 0.15s;
    flex-shrink: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arq-sidebar.collapsed .arq-logout-btn {
    display: none;
}
.arq-logout-btn:hover { color: #a0aec0; }