/* =========================================================
   DOCKSCHOLAR — SHARED WORKSPACE LAYER
   Design tokens, layout, sidebar, common UI components
========================================================= */

/* =========================
   DESIGN TOKENS
========================= */

:root {
    --primary: #0B4F8A;
    --primary-hover: #083A65;

    --background: #F4F7FB;
    --surface: #ffffff;

    --border:#E1E7EF;
    --border-light: #D5DEE8;

    --text: #0B3A68;
    --text-heading: #0B2D5C;
    --muted: #64748b;

    --sidebar: #0B2D5C;
    --sidebar-hover: #0B3A68;
    --sidebar-active: #0B4F8A;
    --sidebar-text: #A7B6C7;

    --danger: #dc2626;

    --sidebar-width: 250px;
    --sidebar-collapsed-width: 65px;

    --radius-sm: 7px;
    --radius-md: 9px;
    --radius-lg: 12px;

    --shadow-modal: 0 25px 70px rgba(0, 0, 0, 0.18);
    --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.08);
    --shadow-card:
        0 1px 2px rgba(15, 45, 75, 0.03),
        0 4px 14px rgba(15, 45, 75, 0.04);   
}


/* =========================
   RESET & BASE
========================= */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--background);
    color: var(--text);
    min-height: 100vh;
}


/* =========================
   SIDEBAR
========================= */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;

    width: var(--sidebar-width);
    height: 100vh;

    background: var(--sidebar);
    padding: 22px 14px;

    display: flex;
    flex-direction: column;

    z-index: 1000;

    transition: width 0.25s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 0 6px 26px;
}

.brand-icon,
.brand-logo {
    width: 44px;
    height: 44px;

    border-radius: 10px;
    background: #FFFFFF;

    box-shadow: 0 1px 3px rgba(0,0,0,0.08);

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;
}

.brand-icon img,
.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brand h1,
.brand-text strong {
    font-size: 20px;
    letter-spacing: -0.2px;
    color: white;
}

.brand span,
.brand-text span {
    color: #94A3B8;
    font-size: 12px;
}

.navigation,
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}


.nav-item {
    height: 44px;

    display: flex;
    align-items: center;
    gap: 13px;

    padding: 0 12px;
    border-radius: 8px;

    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;

    transition:
        background 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
}

.nav-item:hover {
    background: rgba(255,255,255,0.07);
    color: #FFFFFF;
}

.nav-item.active {
    background: #0B4F8A;
    color: #FFFFFF;

    box-shadow:
        inset 3px 0 0 rgba(255,255,255,0.85);
}

.nav-item.disabled {
    opacity: 0.55;
    cursor: default;
}

.nav-item.disabled:hover {
    background: transparent;
    color: var(--sidebar-text);
}

.nav-icon {
    width: 22px;
    flex-shrink: 0;
    text-align: center;
    font-size: 16px;
}

.coming-soon {
    margin-left: auto;
    font-size: 10px;
    padding: 4px 7px;
    border-radius: 4px;
    background: #164E7A;
    color: #94A3B8;
}

.sidebar-bottom {
    margin-top: auto;
}

.version {
    color: #64748B;
    font-size: 10px;
    padding: 16px 12px 0;
}


/* =========================
   SIDEBAR TOGGLE
========================= */

.sidebar-toggle {
    position: absolute;
    top: 72px;
    right: -15px;

    width: 30px;
    height: 36px;

    border: 1px solid #D6E2EE;
    border-radius: 7px;

    background: #FFFFFF;
    color: var(--primary);

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    font-family: inherit;
    font-size: 23px;
    font-weight: 500;
    line-height: 1;

    cursor: pointer;

    box-shadow: 0 2px 7px rgba(11, 45, 92, 0.10);

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;

    z-index: 100;
}


.sidebar-toggle:hover {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);

    box-shadow: 0 4px 12px rgba(11, 79, 138, 0.20);
}

.sidebar-toggle:active {
    transform: scale(0.94);
}


/* =========================
   COLLAPSED SIDEBAR
========================= */

.sidebar.collapsed,
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.main-content.sidebar-collapsed,
body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

.sidebar.collapsed .brand-text,
body.sidebar-collapsed .brand-text,
.sidebar.collapsed .coming-soon,
body.sidebar-collapsed .coming-soon,
.sidebar.collapsed .version,
body.sidebar-collapsed .version {
    display: none;
}

.sidebar.collapsed .brand,
body.sidebar-collapsed .brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar.collapsed .nav-item,
body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    font-size: 0;
    gap: 0;
}

.sidebar.collapsed .nav-icon,
body.sidebar-collapsed .nav-icon {
    font-size: 17px;
    margin: 0;
    width: auto;
}

.sidebar.collapsed .sidebar-toggle,
body.sidebar-collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

/* =========================================================
   CLICKABLE DOCKSCHOLAR BRAND
========================================================= */

.brand-link {
    display: block;
    width: 100%;
    text-decoration: none;
    color: inherit;
}

.brand-link .brand {
    width: 100%;
    cursor: pointer;
    transition:
        transform 0.18s ease,
        opacity 0.18s ease,
        filter 0.18s ease;
}

/* Clear but subtle indication that the brand is clickable */
.brand-link:hover .brand {
    transform: translateY(-1px);
    opacity: 0.92;
    filter: brightness(1.08);
}

.brand-link:active .brand {
    transform: translateY(0);
    opacity: 0.82;
}

.brand-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 4px;
    border-radius: 8px;
}

.brand-link:hover .brand-icon {
    transform: scale(1.06);
}

.brand-link .brand-icon {
    transition: transform 0.18s ease;
}

/* =========================
   MAIN CONTENT
========================= */

.main-content {
    margin-left: var(--sidebar-width);

    min-height: 100vh;

    width: calc(100% - var(--sidebar-width));
    max-width: none;

    box-sizing: border-box;

    padding: 38px 58px 70px;

    transition:
        margin-left 0.25s ease,
        width 0.25s ease;
}


/* =========================
   PAGE HEADER
========================= */

.page-header,
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;

    margin-bottom: 24px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;

    font-size: 12px;
    color: var(--muted);
    margin-bottom: 0px;
}

.breadcrumb span {
    color: #c4c7cc;
}

.topbar h2,
.page-header h2 {
    font-size: 29px;
    line-height: 1.15;
    letter-spacing: -0.7px;
    font-weight: 700;

    margin-bottom: 2px;
}

.page-description,
.subtitle {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.5;
}


/* =========================
   BUTTONS
========================= */

.primary-button,
.add-button {
    border: none;
    background: var(--primary);
    color: white;

    padding: 11px 17px;
    border-radius: var(--radius-sm);

    font-size: 13px;
    font-weight: 600;
    font-family: inherit;

    cursor: pointer;
    white-space: nowrap;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    transition:
        background 0.2s ease,
        transform 0.15s ease;
}

.primary-button:hover,
.add-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(11, 79, 138, 0.16);
}

.primary-button:active,
.add-button:active {
    transform: translateY(0);
}

.primary-button span,
.add-button span {
    font-size: 19px;
    line-height: 12px;
}

.secondary-button {
    border: 1px solid var(--border);
    background: white;
    color: #164E7A;

    padding: 9px 14px;
    border-radius: var(--radius-sm);

    font-size: 12px;
    font-weight: 600;
    font-family: inherit;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.15s ease;
}

.secondary-button:hover {
    background: #F8FAFC;
    border-color: #B8CFE5;
    color: var(--text);
    transform: translateY(-2px);
}

.danger-button {
    border: none;
    background: #FEF2F2;
    color: var(--danger);

    padding: 9px 14px;
    border-radius: var(--radius-sm);

    font-size: 12px;
    font-weight: 600;
    font-family: inherit;

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.15s ease;
}

.danger-button:hover {
    background: #FEE2E2;
    color: #B91C1C;
    transform: translateY(-3px);
}

.cancel-button,
.save-button {
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.cancel-button {
    border: 1px solid var(--border);
    background: white;
    color: #475569;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        color 0.2s ease,
        transform 0.15s ease;
}

.cancel-button:hover {
    background: #F8FAFC;
    border-color: #B8CFE5;
    color: var(--text);
    transform: translateY(-2px);
}

.save-button {
    border: none;
    background: var(--primary);
    color: white;

    transition:
        background 0.2s ease,
        transform 0.15s ease;
}

.save-button:hover {
    background: var(--primary-hover);
    transform: translateY(-3px);
}


/* =========================
   SEARCH
========================= */

.search-container,
.search-wrapper,
.search-box {
    position: relative;
    max-width: 650px;
    flex: 1;
}

.search-box {
    display: flex;
    align-items: center;

    max-width: 800px;
    height: 50px;

    background: #FFFFFF;
    border: 1px solid #D9E1EA;
    border-radius: 10px;

    padding: 0 15px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.search-container input,
.search-wrapper input {
    width: 100%;
    height: 43px;

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;

    padding: 0 40px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);

    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input {
    flex: 1;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    padding: 0;
}

.search-container input:focus,
.search-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.search-box:focus-within {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(11, 79, 138, 0.08);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);

    color: #94A3B8;
    font-size: 19px;
    pointer-events: none;
}

.search-box .search-icon {
    position: static;
    transform: none;
    margin-right: 12px;
    font-size: 22px;
    color: var(--muted);
}

.clear-search {
    display: none;

    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);

    width: 27px;
    height: 27px;

    border: none;
    border-radius: 50%;

    background: #F1F6FB;
    color: #64748B;

    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.search-box .clear-search {
    position: static;
    transform: none;
    width: auto;
    height: auto;
    background: transparent;
    font-size: 22px;
    padding: 4px 8px;
}

.clear-search:hover {
    background: #E5E7EB;
}

.search-box .clear-search:hover {
    background: transparent;
    color: var(--text-heading);
}

.sort-select {
    height: 43px;
    padding: 0 12px;

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;

    color: var(--text);
    font-size: 12px;
    font-family: inherit;

    outline: none;
    cursor: pointer;
}


/* =========================
   SECTION HEADER
========================= */

.section-header, .matrix-header {
    margin-bottom: 15px;
}

.section-header h3,
.section-heading h2,
.matrix-header h3 {
    font-size: 20px;
    line-height: 1.1;
    margin-bottom: 0;
}

.section-header span,
.section-heading p,
.matrix-header span {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
}


/* =========================
   EMPTY STATES
========================= */

.empty-state,
.no-results,
.empty-matrix {
    text-align: center;

    padding: 58px 20px;

    background: white;
    border: 1px dashed #D8E0E8;
    border-radius: 12px;
}

.no-results {
    display: none;
}

.empty-icon,
.empty-matrix-icon {
    width: 52px;
    height: 52px;

    background: #F1F6FB;
    border: 1px solid #E4EDF6;

    border-radius: 14px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0 auto 14px;

    font-size: 23px;
}

.empty-state h3,
.no-results h3,
.empty-matrix h3 {
    font-size: 16px;
    margin-bottom: 6px;
}

.empty-state p,
.no-results p,
.empty-matrix p {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 19px;
}

.empty-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: none;
    background: var(--primary);
    color: white;

    padding: 10px 15px;
    border-radius: var(--radius-sm);

    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
}


.card,
.stat-card,
.matrix-card {
    background: var(--surface);
    border: 1px solid var(--border);

    box-shadow: var(--shadow-card);
}

/* =========================
   MODAL SHELL
========================= */

.modal-overlay {
    display: none;

    position: fixed;
    inset: 0;

    background: rgba(15, 23, 42, 0.55);
    z-index: 2000;

    padding: 24px;
    overflow-y: auto;

    align-items: center;
    justify-content: center;
}

.modal-overlay.show,
.modal-overlay.active {
    display: flex;
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    width: 100%;
    max-width: 650px;
    max-height: calc(100vh - 48px);

    background: white;
    border-radius: 13px;
    box-shadow: var(--shadow-modal);

    overflow-y: auto;
    margin: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;

    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-header h2,
.modal-header h3 {
    font-size: 18px;
    margin-bottom: 4px;
}

.modal-header p {
    color: var(--muted);
    font-size: 11px;
}

.modal-label {
    display: block;
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.modal-close,
.close-modal {
    width: 30px;
    height: 30px;
    flex-shrink: 0;

    border: none;
    background: #F1F6FB;
    color: #64748B;

    border-radius: 6px;
    cursor: pointer;

    font-size: 20px;
    line-height: 1;
}

.modal-close {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: #f1f5f9;
    color: var(--muted);
    font-size: 22px;
}

.modal-close:hover,
.close-modal:hover {
    background: #E5E7EB;
}

.modal-body {
    padding: 24px;
}

.modal-footer,
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.modal-actions {
    border-top: none;
    padding-top: 5px;
}


/* =========================
   FORM CONTROLS
========================= */

.form-group {
    margin-bottom: 17px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #334155;
}

.form-group label span {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);

    padding: 0 11px;
    font-size: 12px;
    font-family: inherit;
    color: var(--text);

    outline: none;
    background: white;
}

.form-group input,
.form-group select {
    height: 40px;
}

.form-group textarea {
    min-height: 110px;
    padding: 10px 11px;
    line-height: 1.6;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 79, 138, 0.10);
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #94A3B8;
    font-size: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 14px;
}

.form-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 16px;
}


/* =========================
   TOAST
========================= */

.toast {
    position: fixed;
    right: 25px;
    bottom: 25px;

    padding: 11px 15px;
    border-radius: var(--radius-sm);

    background: #0B2D5C;
    color: white;
    font-size: 12px;

    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;

    transition: 0.25s;
    z-index: 3000;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}


/* =========================
   RESPONSIVE — WORKSPACE
========================= */

@media (max-width: 900px) {
    .sidebar:not(.collapsed) {
        width: 210px;
    }

    .main-content:not(.sidebar-collapsed) {
        margin-left: 210px;
        padding: 30px;
    }
}

@media (max-width: 700px) {
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        padding: 15px;
    }

    .sidebar.collapsed,
    body.sidebar-collapsed .sidebar {
        width: 100%;
    }

    .brand {
        padding-bottom: 15px;
    }

    .navigation,
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
    }

    .nav-item {
        white-space: nowrap;
        font-size: 15px;
    }

    .sidebar.collapsed .nav-item,
    body.sidebar-collapsed .nav-item {
        font-size: 15px;
        justify-content: flex-start;
        padding: 0 12px;
    }

    .sidebar.collapsed .brand-text,
    body.sidebar-collapsed .brand-text {
        display: flex;
    }

    .sidebar-bottom {
        display: none;
    }

    .sidebar-toggle {
        display: none;
    }

    .main-content,
    .main-content.sidebar-collapsed,
    body.sidebar-collapsed .main-content {
        margin-left: 0;
        padding: 20px 18px;
    }

    .page-header,
    .topbar {
        flex-direction: column;
    }

    .primary-button,
    .add-button {
        width: 100%;
        justify-content: center;
    }

    .search-container,
    .search-wrapper {
        max-width: none;
    }

    .sort-select {
        width: 100%;
    }

    .form-row,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-overlay {
        padding: 12px;
        align-items: flex-start;
    }

    .modal {
        max-height: 95vh;
    }
}

@media (max-width: 650px) {
    .main-content:not(.sidebar-collapsed) {
        margin-left: var(--sidebar-collapsed-width);
        padding: 25px 16px;
    }

    .sidebar:not(.collapsed) {
        width: var(--sidebar-collapsed-width);
        padding: 20px 10px;
    }

    .sidebar:not(.collapsed) .brand-text,
    .sidebar:not(.collapsed) .coming-soon,
    .sidebar:not(.collapsed) .version {
        display: none;
    }

    .sidebar:not(.collapsed) .brand {
        justify-content: center;
    }

    .sidebar:not(.collapsed) .nav-item {
        justify-content: center;
        padding: 0;
        gap: 0;
    }
}
