/* ==================================================
   THE AETHERIUM
   The Bizarre Bazaar
   Shared Visual Identity
   Version 0.1
   ================================================== */

:root {
    --charcoal: #171A1D;
    --slate: #252B30;
    --slate-light: #30373D;
    --brass: #B89A60;
    --brass-light: #D2B77F;
    --ivory: #E4DCCB;
    --verdigris: #536B60;

    --text-primary: #E4DCCB;
    --text-secondary: #B1B5B5;
    --text-muted: #969D9F;

    --border: #3C4449;
    --border-brass: #66583F;

    --success: #9CB9A6;
    --warning: #D5B47A;
    --danger: #D58D8D;

    --font-heading: 'Cinzel', Georgia, serif;
    --font-body: 'Inter', Arial, sans-serif;

    --sidebar-width: 260px;
    --header-height: 68px;

    --radius-small: 5px;
    --radius-medium: 8px;
    --radius-large: 12px;

    --transition: 160ms ease;
}


/* ==================================================
   RESET AND BASE
   ================================================== */

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-height: 100%;
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--charcoal);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: default;
}

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--brass-light);
    outline-offset: 4px;
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: 500;
    line-height: 1.35;
}

p {
    margin: 0;
}

a {
    color: var(--brass-light);
}

svg {
    flex-shrink: 0;
}

::selection {
    background: var(--brass);
    color: var(--charcoal);
}


/* ==================================================
   BRAND ELEMENTS
   ================================================== */

.triple-moon {
    color: var(--brass);
    font-family: Georgia, serif;
    font-size: 38px;
    line-height: 1.2;
    letter-spacing: 5px;
}

.eyebrow {
    color: var(--brass);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.ornamental-divider {
    width: 150px;
    height: 1px;
    margin: 22px auto;
    position: relative;
    background: linear-gradient(
        to right,
        transparent,
        var(--brass),
        transparent
    );
}

.ornamental-divider::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 6px;
    height: 6px;
    background: var(--brass);
    transform: translate(-50%, -50%) rotate(45deg);
}


/* ==================================================
   LOADING SCREEN
   ================================================== */

.loading-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 24px;
    text-align: center;
}

.loading-screen h1 {
    color: var(--brass);
    font-size: 32px;
}

.loading-screen p {
    color: var(--text-secondary);
    font-size: 13px;
}

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-top-color: var(--brass);
    border-radius: 50%;
    animation: spin 900ms linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


/* ==================================================
   LOGIN
   ================================================== */

.login-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: radial-gradient(
        ellipse at 50% 35%,
        #2A3033 0%,
        var(--charcoal) 65%
    );
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 44px 38px;
    background: var(--slate);
    border: 1px solid var(--border-brass);
    border-radius: var(--radius-large);
    text-align: center;
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.25);
}

.login-card .triple-moon {
    margin-bottom: 20px;
}

.login-card .eyebrow {
    margin-bottom: 12px;
}

.login-card h1 {
    color: var(--ivory);
    font-size: 34px;
}

.login-intro {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 30px;
}

#login-form {
    text-align: left;
}

#login-form .button {
    width: 100%;
    margin-top: 8px;
}

.restricted-notice {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 24px;
    letter-spacing: 1px;
}

.login-footer {
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 11px;
}


/* ==================================================
   SHARED FORM ELEMENTS
   ================================================== */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 20px;
}

.form-group label {
    color: var(--ivory);
    font-size: 12px;
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 11px 13px;
    background: var(--charcoal);
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    color: var(--ivory);
    outline: none;
    transition: border-color var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brass);
    box-shadow: 0 0 0 1px var(--brass);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-height: auto;
    accent-color: var(--brass);
}

.form-message {
    margin: 12px 0;
    padding: 12px 14px;
    border: 1px solid #704747;
    border-radius: var(--radius-small);
    background: #382829;
    color: var(--danger);
    font-size: 12px;
}


/* ==================================================
   SHARED BUTTONS
   ================================================== */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 44px;
    padding: 12px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-small);
    font-size: 13px;
    font-weight: 600;
    transition:
        background var(--transition),
        border-color var(--transition);
}

.button-primary {
    background: var(--brass);
    color: var(--charcoal);
}

.button-primary:hover:not(:disabled) {
    background: var(--brass-light);
}

.button-secondary {
    background: var(--slate);
    border-color: var(--border);
    color: var(--ivory);
}

.button-secondary:hover:not(:disabled) {
    border-color: var(--brass);
}

.button:disabled {
    opacity: 0.5;
}

.icon-button {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    color: var(--brass);
}

.icon-button:hover {
    background: var(--slate-light);
}

.icon-button svg {
    width: 19px;
    height: 19px;
}


/* ==================================================
   APPLICATION LAYOUT
   ================================================== */

.application {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: #1D2226;
    border-right: 1px solid var(--border);
    transition: transform var(--transition);
}

.main-workspace {
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition:
        margin-left var(--transition),
        width var(--transition);
}

.application.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

.application.sidebar-collapsed .main-workspace {
    margin-left: 0;
    width: 100%;
}


/* ==================================================
   SIDEBAR BRAND
   ================================================== */

.sidebar-brand {
    text-align: center;
    padding: 28px 16px 25px;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand .triple-moon {
    font-size: 27px;
    margin-bottom: 12px;
}

.sidebar-title {
    color: var(--brass);
    font-family: var(--font-heading);
    font-size: 21px;
}

.sidebar-subtitle {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 9px;
    letter-spacing: 2px;
}


/* ==================================================
   SIDEBAR NAVIGATION
   ================================================== */

.sidebar-navigation {
    flex: 1;
    overflow-y: auto;
    padding: 15px 12px;
}

.navigation-label {
    margin: 16px 10px 8px;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 1.5px;
}

.nav-item {
    width: 100%;
    min-height: 43px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 3px 0;
    border: 1px solid transparent;
    border-radius: var(--radius-small);
    background: transparent;
    color: var(--text-secondary);
    text-align: left;
    font-size: 12px;
    transition:
        background var(--transition),
        color var(--transition);
}

.nav-item svg {
    width: 17px;
    height: 17px;
    color: var(--brass);
    stroke-width: 1.5;
}

.nav-item:hover:not(:disabled) {
    background: var(--slate);
    color: var(--ivory);
}

.nav-item.active {
    background: #30332E;
    border-color: var(--border-brass);
    color: var(--brass-light);
}

.nav-item:disabled {
    opacity: 0.55;
}

.nav-item:disabled svg {
    color: var(--text-muted);
}


/* ==================================================
   STAFF PROFILE
   ================================================== */

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border);
}

.staff-profile {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px;
    margin-bottom: 10px;
}

.staff-avatar {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--slate);
    border: 1px solid var(--border-brass);
    border-radius: 50%;
    color: var(--brass);
}

.staff-avatar svg {
    width: 18px;
    height: 18px;
}

.staff-details {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.staff-details strong {
    color: var(--ivory);
    font-size: 13px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.staff-details span {
    color: var(--text-muted);
    font-size: 10px;
}

.logout-button {
    color: var(--text-muted);
}


/* ==================================================
   WORKSPACE HEADER
   ================================================== */

.workspace-header {
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 28px;
    background: #1D2226;
    border-bottom: 1px solid var(--border);
}

.breadcrumb {
    flex: 1;
    min-width: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    font-size: 10px;
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: var(--text-muted);
    border-radius: 50%;
}

.status-dot.connected {
    background: var(--success);
}

.status-dot.disconnected {
    background: var(--danger);
}


/* ==================================================
   WORKSPACE CONTENT
   ================================================== */

.workspace-view {
    width: 100%;
    max-width: 1440px;
    flex: 1;
    margin: 0 auto;
    padding: 32px;
}

.workspace-title {
    margin-bottom: 30px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.workspace-title .eyebrow {
    margin-bottom: 9px;
}

.workspace-title h1 {
    font-size: 30px;
    color: var(--ivory);
}

.workspace-title p {
    margin-top: 9px;
    color: var(--text-secondary);
    font-size: 13px;
}


/* ==================================================
   THE GRAND HALL
   ================================================== */

.grand-hall-masthead {
    padding: 38px 24px;
    margin-bottom: 32px;
    text-align: center;
    border: 1px solid var(--border-brass);
    border-radius: var(--radius-medium);
    background: radial-gradient(
        ellipse at top,
        #30332F,
        var(--slate) 75%
    );
}

.grand-hall-masthead .triple-moon {
    margin-bottom: 15px;
}

.grand-hall-masthead .eyebrow {
    margin-bottom: 10px;
}

.grand-hall-masthead h1 {
    color: var(--ivory);
    font-size: 38px;
}

.grand-hall-masthead p {
    color: var(--text-secondary);
    font-size: 13px;
}

.section-heading {
    margin-bottom: 20px;
}

.section-heading h2 {
    font-size: 20px;
    color: var(--brass);
}

.section-heading p {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 12px;
}


/* ==================================================
   OPERATIONAL CHAMBER CARDS
   ================================================== */

.chamber-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.chamber-card {
    min-width: 0;
    min-height: 205px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 23px;
    background: var(--slate);
    border: 1px solid var(--border-brass);
    border-radius: var(--radius-medium);
    color: var(--ivory);
    text-align: left;
    transition:
        background var(--transition),
        border-color var(--transition),
        transform var(--transition);
}

.chamber-card > svg {
    width: 30px;
    height: 30px;
    color: var(--brass);
    stroke-width: 1.4;
}

.chamber-card h3 {
    font-size: 16px;
}

.chamber-card p {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
}

.chamber-card:hover:not(:disabled) {
    background: var(--slate-light);
    border-color: var(--brass);
    transform: translateY(-2px);
}

.chamber-card:disabled {
    border-color: var(--border);
}

.chamber-card:disabled > svg {
    color: var(--text-muted);
}

.chamber-card:disabled h3 {
    color: var(--text-secondary);
}

.chamber-status {
    margin-top: auto;
    padding-top: 12px;
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: 0.6px;
}

.chamber-status.available {
    color: var(--success);
}


/* ==================================================
   MASTER REGISTERS
   ================================================== */

.register-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.register-card {
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 130px;
    padding: 24px;
    background: var(--slate);
    border: 1px solid var(--border-brass);
    border-radius: var(--radius-medium);
    color: var(--ivory);
    text-align: left;
}

.register-card:hover {
    border-color: var(--brass);
    background: var(--slate-light);
}

.register-card > svg:first-child {
    width: 32px;
    height: 32px;
    color: var(--brass);
    stroke-width: 1.4;
}

.register-card > div {
    flex: 1;
    min-width: 0;
}

.register-card h2 {
    font-size: 17px;
    margin-bottom: 8px;
}

.register-card p {
    font-size: 12px;
    color: var(--text-secondary);
}

.register-card > svg:last-child {
    width: 18px;
    color: var(--brass);
}


/* ==================================================
   MATERIALS REGISTER ACTIONS
   ================================================== */

.material-action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 13px;
    min-height: 170px;
    padding: 22px;
    background: var(--slate);
    border: 1px solid var(--border-brass);
    border-radius: var(--radius-medium);
    color: var(--ivory);
    text-align: left;
}

.action-card > svg {
    width: 28px;
    height: 28px;
    color: var(--brass);
    stroke-width: 1.5;
}

.action-card h2 {
    font-size: 16px;
}

.action-card p {
    color: var(--text-secondary);
    font-size: 12px;
}

.action-card:hover:not(:disabled) {
    background: var(--slate-light);
    border-color: var(--brass);
}

.action-card:disabled {
    border-color: var(--border);
}

.action-card:disabled > svg {
    color: var(--text-muted);
}

.workspace-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 16px 18px;
    background: var(--slate);
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    color: var(--text-secondary);
    font-size: 12px;
}

.workspace-notice svg {
    width: 18px;
    color: var(--brass);
}


/* ==================================================
   SHARED WORKING INTERFACES
   ================================================== */

.panel {
    padding: 24px;
    margin-bottom: 20px;
    background: var(--slate);
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
}

.panel h2 {
    margin-bottom: 20px;
    color: var(--brass);
    font-size: 17px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 20px;
}

.form-grid .full-width {
    grid-column: 1 / -1;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: left;
}

th {
    padding: 13px 15px;
    background: var(--slate-light);
    color: var(--brass-light);
    font-weight: 500;
    white-space: nowrap;
}

td {
    padding: 13px 15px;
    border-top: 1px solid var(--border);
    color: var(--text-primary);
}

tbody tr:hover {
    background: var(--slate);
}


/* ==================================================
   FOOTER
   ================================================== */

.workspace-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 32px;
    margin-top: auto;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 10px;
}


/* ==================================================
   RESPONSIVE: TABLET
   ================================================== */

@media (max-width: 1200px) {

    :root {
        --sidebar-width: 235px;
    }

    .workspace-view {
        padding: 24px;
    }

    .chamber-grid,
    .material-action-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .register-grid {
        grid-template-columns: 1fr;
    }

}


/* ==================================================
   RESPONSIVE: IPAD AND MOBILE
   ================================================== */

@media (max-width: 900px) {

    .sidebar {
        width: 260px;
        transform: translateX(-100%);
        box-shadow: 15px 0 50px rgba(0, 0, 0, 0.3);
    }

    .application.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .main-workspace {
        width: 100%;
        margin-left: 0;
    }

    .application.sidebar-open .main-workspace {
        margin-left: 0;
        width: 100%;
    }

    .application.sidebar-open .workspace-header {
        padding-left: 276px;
    }

    .workspace-header {
        padding: 12px 20px;
    }

    .nav-item {
        min-height: 46px;
    }

    input,
    select,
    textarea {
        font-size: 16px;
        min-height: 48px;
    }

    .button {
        min-height: 48px;
    }

}


/* ==================================================
   RESPONSIVE: SMALL SCREENS
   ================================================== */

@media (max-width: 560px) {

    .workspace-view {
        padding: 18px;
    }

    .workspace-header {
        padding: 10px 15px;
        gap: 10px;
    }

    .application.sidebar-open .workspace-header {
        padding-left: 15px;
    }

    .application.sidebar-open .sidebar {
        top: var(--header-height);
    }

    .connection-status span:last-child {
        display: none;
    }

    .grand-hall-masthead {
        padding: 28px 15px;
    }

    .grand-hall-masthead h1 {
        font-size: 29px;
    }

    .chamber-grid,
    .material-action-grid,
    .register-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .chamber-card,
    .action-card {
        min-height: auto;
        padding: 20px;
    }

    .workspace-title h1 {
        font-size: 25px;
    }

    .login-card {
        padding: 32px 24px;
    }

    .login-card h1 {
        font-size: 29px;
    }

    .panel {
        padding: 18px;
    }

    .workspace-footer {
        flex-direction: column;
        padding: 18px;
    }

}


/* ==================================================
   ACCESSIBILITY
   ================================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

}
