/* === Arc Platform — Layout, Sidebar, Buttons, Modals, Forms === */

/* ─── SIDEBAR (icon-only, dark) ──────────────────────────── */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: #0f172a;
    display: flex; flex-direction: column;
    align-items: center;
    padding: 16px 0;
    z-index: 100;
}
.sidebar-logo {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 32px;
    cursor: pointer;
}
.logo-mark {
    font-size: 1.5rem; font-weight: 900; color: #fff;
    letter-spacing: -0.03em; position: relative;
    background: none; width: auto; height: auto; border-radius: 0;
}
.logo-dot {
    display: inline-block; width: 5px; height: 5px; border-radius: 50%;
    background: var(--primary); vertical-align: baseline; margin-left: 1px;
}
.logo-text { display: none; }

.sidebar-nav {
    list-style: none; display: flex; flex-direction: column;
    gap: 4px; flex: 1; width: 100%; align-items: center;
}
.sidebar-nav-item {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #94a3b8; background: transparent;
    cursor: pointer; transition: all 0.15s;
    position: relative; border: none; padding: 0;
    font-size: 0; /* hide text labels */
}
.sidebar-nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-nav-item:hover {
    background: rgba(255,255,255,0.1); color: #fff;
}
.sidebar-nav-item.active {
    background: rgba(249,114,22,0.12); color: var(--primary);
}
.sidebar-nav-item.active::before {
    content: ''; position: absolute; left: -14px;
    width: 3px; height: 24px; border-radius: 0 3px 3px 0;
    background: var(--primary);
}
/* Tooltip on hover */
.sidebar-nav-item .nav-tooltip {
    position: absolute; left: 56px; top: 50%; transform: translateY(-50%);
    background: #1e293b; color: #fff;
    padding: 4px 10px; border-radius: 6px;
    font-size: 12px; font-weight: 500;
    white-space: nowrap; pointer-events: none;
    opacity: 0; transition: opacity 0.15s;
    z-index: 200;
}
.sidebar-nav-item:hover .nav-tooltip { opacity: 1; }
/* Hide old elements */
.sidebar-nav-item .nav-icon { display: none; }
.sidebar-section { display: none; }
.sidebar-section-title { display: none; }
.filter-count { display: none; }
.sidebar-footer { display: none; }
/* Divider between nav groups */
.sidebar-divider {
    width: 28px; height: 1px; background: rgba(255,255,255,0.1);
    margin: 8px 0;
}

/* ─── MAIN CONTENT ───────────────────────────────────────── */
.main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 0;
    background: #F5F5F7;
}

/* ─── HEADER ─────────────────────────────────────────────── */
.header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 32px;
    background: rgba(255,255,255,0.8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 12px; }
.header-search {
    display: flex; align-items: center; gap: 10px; padding: 10px 16px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--gray-6); font-size: 14px; width: 260px;
    box-shadow: none;
}
/* ─── BUTTONS ────────────────────────────────────────────── */
.btn-primary {
    padding: 10px 22px; border-radius: 50px; font-size: 13px; font-weight: 600;
    cursor: pointer; border: none;
    background: var(--primary);
    color: #fff; transition: all 0.25s ease;
    font-family: inherit; letter-spacing: 0.01em;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249,114,22,0.25);
}
.btn-primary:active { transform: translateY(0); box-shadow: none; }
.btn-primary:disabled {
    opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none;
}
.btn-secondary {
    padding: 10px 22px; border-radius: 50px; font-size: 13px; font-weight: 500;
    cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary);
    transition: all 0.25s ease; font-family: inherit;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-secondary:hover { border-color: var(--border); color: var(--text-primary); background: var(--gray-6); }
.btn-sm { padding: 7px 16px; font-size: 12px; }
.btn-danger {
    padding: 10px 22px; border-radius: 50px; font-size: 13px; font-weight: 600;
    cursor: pointer; border: 1px solid var(--gray-3);
    background: var(--surface);
    color: var(--text-primary); transition: all 0.25s ease; font-family: inherit;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-danger:hover { background: #1D1D1F; color: #fff; border-color: #1D1D1F; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }

/* ─── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
    animation: fadeIn 0.15s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.modal-card {
    background: var(--surface); border-radius: 24px; width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
    animation: modalSlideUp 0.2s ease;
}
@keyframes modalSlideUp {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-lg { max-width: 720px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 24px 28px 0; }
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close { font-size: 24px; color: var(--text-muted); cursor: pointer; border: none; background: none; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 20px 28px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 28px 24px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-primary); }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-md);
    font-size: 14px; font-family: inherit; outline: none; transition: all 0.15s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249,114,22,0.08);
}
/* Multi-select checkbox groups: override form-group input width */
.multi-select-group input[type="checkbox"] {
    width: auto; padding: 0; border: none; border-radius: 0;
}
.multi-select-group input[type="checkbox"]:focus {
    box-shadow: none;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.modal-wide { max-width: 680px; }
.form-section-label {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--text-muted); margin-bottom: 12px; padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light); display: flex; align-items: baseline; gap: 8px;
}
.form-section-hint {
    font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0;
    color: var(--text-muted); opacity: 0.7;
}
.form-hint {
    font-size: 11px; color: var(--text-muted); margin-top: 4px; opacity: 0.6;
}
@media (max-width: 700px) {
    .modal-wide { max-width: 95vw; }
    .form-row-3 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

/* Admin: button variants */
.btn-xs {
    padding: 3px 10px;
    font-size: 11px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
    transition: all 0.15s ease;
}
.btn-xs:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 5px 14px;
    font-size: 12px;
    border-radius: 8px;
}

/* ─── WORKSPACE SWITCHER ─────────────────────────────────── */
.workspace-switcher {
    position: relative;
    margin-right: 12px;
}
.ws-current {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px; border-radius: 8px;
    cursor: pointer; transition: background 0.15s;
    font-size: 13px; font-weight: 600; color: var(--text-primary);
    border: 1px solid var(--border); background: var(--surface);
}
.ws-current:hover { background: var(--gray-6); }
.ws-current svg { color: var(--text-muted); transition: transform 0.2s; }
.workspace-switcher.open .ws-current svg { transform: rotate(180deg); }
.ws-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    flex-shrink: 0;
}
.ws-name {
    max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-dropdown {
    position: absolute; top: calc(100% + 4px); left: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    min-width: 220px; padding: 4px; z-index: 200;
    display: none;
}
.workspace-switcher.open .ws-dropdown { display: block; }
.ws-option {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-radius: 6px;
    cursor: pointer; font-size: 13px; color: var(--text-primary);
    transition: background 0.1s;
}
.ws-option:hover { background: var(--gray-6); }
.ws-option.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.ws-divider {
    height: 1px; background: var(--border); margin: 4px 8px;
}
.ws-new {
    color: var(--text-muted); font-weight: 500;
}
.ws-new:hover { color: var(--primary); }

/* ─── USER PROFILE MENU ─────────────────────────────────── */
.user-profile {
    position: relative;
    margin-left: 4px;
}
.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F97216, #EA580C);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 2px solid transparent;
}
.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(249, 114, 22, 0.25);
}
.user-profile.open .user-avatar {
    border-color: var(--primary);
}
.user-initials {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.02em;
    line-height: 1;
    user-select: none;
}
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    min-width: 240px;
    padding: 0;
    z-index: 200;
    display: none;
    overflow: hidden;
}
.user-profile.open .user-dropdown {
    display: block;
}
.user-dropdown-header {
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--border);
}
.user-dropdown-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.user-dropdown-email {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-dropdown-divider {
    height: 1px;
    background: var(--border);
}
.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
}
.user-dropdown-item:hover {
    background: var(--gray-6);
}
.user-dropdown-item svg {
    color: var(--text-muted);
    flex-shrink: 0;
}
.user-dropdown-item.user-signout {
    color: var(--red);
    border-top: 1px solid var(--border);
}
.user-dropdown-item.user-signout svg {
    color: var(--red);
}

/* ─── MOBILE RESPONSIVE ──────────────────────────────────── */
@media (max-width: 768px) {
    /* Header */
    .header { padding: 12px 16px; }
    .header-search { display: none; }
    .header-right { gap: 8px; }
    .header-left { gap: 8px; }
    .ws-name { max-width: 100px; font-size: 12px; }
    .ws-current { padding: 5px 8px; font-size: 12px; }

    /* Buttons */
    .btn-primary { padding: 8px 16px; font-size: 12px; }
    .btn-secondary { padding: 8px 16px; font-size: 12px; }
    .btn-danger { padding: 8px 16px; font-size: 12px; }

    /* Modals */
    .modal-card { max-width: 95vw; border-radius: 16px; margin: 16px; }
    .modal-header { padding: 16px 20px 0; }
    .modal-header h3 { font-size: 16px; }
    .modal-body { padding: 16px 20px; }
    .modal-footer { padding: 10px 20px 16px; }
    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }

    /* User dropdown */
    .user-dropdown { min-width: 200px; }
}

