/* ==================================================
   THE AETHERIUM
   Master Registers / Materials
   Materials Workspace Stylesheet
   Version 1.0
   ================================================== */

.materials-workspace {
    --mat-brass: #B89A60;
    --mat-ivory: #E4DCCB;
    --mat-charcoal: #171A1D;
    --mat-slate: #252B30;
    --mat-green: #536B60;
    --mat-muted: #A5A9A8;
    --mat-border: rgba(184, 154, 96, 0.22);
    --mat-error: #D99A94;

    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    color: var(--mat-ivory);
}

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


/* ==================================================
   WORKSPACE NAVIGATION
   ================================================== */

.mat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.mat-toolbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.mat-back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border: 0;
    background: transparent;
    color: var(--mat-brass);
    font: inherit;
    cursor: pointer;
}

.mat-back-button:hover {
    color: var(--mat-ivory);
}

.mat-heading {
    margin-bottom: 24px;
}

.mat-heading h1 {
    font-family: 'Cinzel', serif;
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 500;
    margin: 0 0 8px;
}

.mat-heading p {
    color: var(--mat-muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}


/* ==================================================
   WORKSPACE PANELS
   ================================================== */

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

.mat-section-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.mat-section-number {
    color: var(--mat-brass);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
}

.mat-section-heading h2 {
    margin: 0;
    font-family: 'Cinzel', serif;
    font-size: 18px;
    font-weight: 500;
}

.mat-section-heading svg {
    width: 20px;
    height: 20px;
    color: var(--mat-brass);
}

.mat-help {
    color: var(--mat-muted);
    font-size: 13px;
    line-height: 1.6;
    margin: 6px 0;
}


/* ==================================================
   PHOTOGRAPH CAPTURE
   ================================================== */

.mat-photo-zone {
    padding: 30px 20px;
    border: 1px dashed var(--mat-brass);
    border-radius: 8px;
    background: var(--mat-charcoal);
    text-align: center;
}

.mat-photo-zone > svg {
    width: 46px;
    height: 46px;
    color: var(--mat-brass);
    stroke-width: 1.3;
    margin-bottom: 12px;
}

.mat-photo-zone h3 {
    font-family: 'Cinzel', serif;
    font-weight: 500;
    font-size: 19px;
    margin: 0 0 8px;
}

.mat-photo-zone p {
    color: var(--mat-muted);
    font-size: 13px;
    line-height: 1.6;
    margin: 0 0 20px;
}

.mat-photo-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.mat-file-input {
    display: none;
}

.mat-photo-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fill, minmax(145px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.mat-photo-card {
    position: relative;
    overflow: hidden;
    background: var(--mat-charcoal);
    border: 1px solid var(--mat-border);
    border-radius: 6px;
}

.mat-photo-card img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #111315;
}

.mat-photo-caption {
    padding: 10px;
    font-size: 12px;
    color: var(--mat-muted);
}

.mat-primary-label {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 5px 9px;
    border-radius: 4px;
    background: var(--mat-brass);
    color: var(--mat-charcoal);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.mat-photo-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    background: rgba(23, 26, 29, 0.9);
    border: 1px solid var(--mat-border);
    border-radius: 5px;
    color: var(--mat-ivory);
    cursor: pointer;
}

.mat-photo-remove:hover {
    color: var(--mat-error);
}

.mat-photo-remove svg {
    width: 18px;
    height: 18px;
}


/* ==================================================
   MATERIAL CAPTURE FORM
   ================================================== */

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

.mat-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.mat-field-full {
    grid-column: 1 / -1;
}

.mat-field label {
    color: var(--mat-ivory);
    font-size: 13px;
    font-weight: 500;
}

.mat-required {
    color: var(--mat-brass);
}

.mat-field input,
.mat-field select,
.mat-field textarea,
.mat-search-input {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    background: var(--mat-charcoal);
    border: 1px solid var(--mat-border);
    border-radius: 5px;
    color: var(--mat-ivory);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.4;
    color-scheme: dark;
}

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

.mat-field input::placeholder,
.mat-field textarea::placeholder,
.mat-search-input::placeholder {
    color: #919796;
}

.mat-field input:focus,
.mat-field select:focus,
.mat-field textarea:focus,
.mat-search-input:focus {
    outline: 2px solid var(--mat-brass);
    outline-offset: 1px;
    border-color: var(--mat-brass);
}

.mat-field input:disabled,
.mat-field select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mat-field input[readonly] {
    color: var(--mat-muted);
}

.mat-field-hint {
    font-size: 12px;
    line-height: 1.5;
    color: var(--mat-muted);
}

.mat-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
}

.mat-checkbox-row input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--mat-brass);
    cursor: pointer;
}

.mat-checkbox-row label {
    font-size: 14px;
    line-height: 1.6;
    cursor: pointer;
}

.mat-checkbox-row small {
    display: block;
    color: var(--mat-muted);
    font-size: 12px;
}


/* ==================================================
   INLINE SUBCATEGORY CREATION
   ================================================== */

.mat-inline-link {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 6px;
    padding: 7px 0;
    background: transparent;
    border: 0;
    color: var(--mat-brass);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.mat-inline-link:hover {
    color: var(--mat-ivory);
}

.mat-inline-link svg {
    width: 16px;
    height: 16px;
}

.mat-inline-panel {
    padding: 16px;
    margin-top: 5px;
    border: 1px solid var(--mat-border);
    border-radius: 5px;
    background: var(--mat-charcoal);
}

.mat-inline-panel h3 {
    font-size: 14px;
    font-weight: 500;
    margin: 0 0 12px;
}

.mat-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}


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

.mat-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 46px;
    padding: 12px 20px;
    border: 1px solid var(--mat-border);
    border-radius: 5px;
    background: transparent;
    color: var(--mat-ivory);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    cursor: pointer;
    transition:
        background 150ms ease,
        border-color 150ms ease;
}

.mat-button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

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

.mat-button-primary:hover:not(:disabled) {
    background: #CBB17C;
}

.mat-button-secondary {
    border-color: var(--mat-brass);
    color: var(--mat-brass);
}

.mat-button-secondary:hover:not(:disabled) {
    background: rgba(184, 154, 96, 0.1);
}

.mat-button-danger {
    border-color: rgba(217, 154, 148, 0.5);
    color: var(--mat-error);
}

.mat-button:disabled,
.mat-inline-link:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.mat-button:focus-visible,
.mat-back-button:focus-visible,
.mat-inline-link:focus-visible,
.mat-photo-remove:focus-visible {
    outline: 2px solid var(--mat-brass);
    outline-offset: 3px;
}

.mat-form-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px 0;
    border-top: 1px solid var(--mat-border);
}


/* ==================================================
   MESSAGES AND REGISTRATION STATUS
   ================================================== */

.mat-message {
    padding: 14px 16px;
    margin: 14px 0;
    border: 1px solid var(--mat-border);
    border-radius: 5px;
    background: var(--mat-charcoal);
    color: var(--mat-ivory);
    font-size: 13px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.mat-message-success {
    border-color: #708E7F;
    background: rgba(83, 107, 96, 0.18);
    color: #C4DDCF;
}

.mat-message-error {
    border-color: rgba(217, 154, 148, 0.5);
    color: var(--mat-error);
}

.mat-message-warning {
    border-color: var(--mat-brass);
    color: #D9C28D;
}

.mat-loading {
    padding: 32px 16px;
    text-align: center;
    color: var(--mat-muted);
    font-size: 14px;
}

.mat-empty-state {
    padding: 40px 20px;
    text-align: center;
    border: 1px dashed var(--mat-border);
    border-radius: 6px;
    color: var(--mat-muted);
}

.mat-empty-state svg {
    width: 36px;
    height: 36px;
    margin-bottom: 12px;
    color: var(--mat-brass);
    stroke-width: 1.3;
}

.mat-empty-state h3 {
    color: var(--mat-ivory);
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 8px;
}

.mat-empty-state p {
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
}


/* ==================================================
   MATERIAL SEARCH AND FILTERS
   ================================================== */

.mat-search-bar {
    display: grid;
    grid-template-columns:
        minmax(0, 2fr) minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.mat-search-wrapper {
    position: relative;
}

.mat-search-wrapper > svg {
    position: absolute;
    top: 15px;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--mat-brass);
    pointer-events: none;
}

.mat-search-wrapper .mat-search-input {
    padding-left: 44px;
}

.mat-results-count {
    color: var(--mat-muted);
    font-size: 13px;
    margin-bottom: 14px;
}


/* ==================================================
   MATERIAL RECORDS TABLE
   ================================================== */

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

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

.mat-table th {
    padding: 14px;
    background: var(--mat-charcoal);
    border-bottom: 1px solid var(--mat-border);
    color: var(--mat-brass);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
}

.mat-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--mat-border);
    vertical-align: middle;
    line-height: 1.5;
}

.mat-table tr:last-child td {
    border-bottom: 0;
}

.mat-table tbody tr:hover {
    background: rgba(184, 154, 96, 0.04);
}

.mat-table .mat-numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mat-table-name {
    font-weight: 600;
    color: var(--mat-ivory);
}

.mat-reference {
    display: block;
    color: var(--mat-brass);
    font-size: 11px;
    letter-spacing: 0.4px;
    margin-top: 4px;
}

.mat-thumbnail {
    width: 54px;
    height: 54px;
    display: block;
    object-fit: contain;
    border-radius: 4px;
    background: var(--mat-charcoal);
    border: 1px solid var(--mat-border);
}

.mat-thumbnail-placeholder {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    background: var(--mat-charcoal);
    border: 1px solid var(--mat-border);
    border-radius: 4px;
    color: var(--mat-muted);
}

.mat-thumbnail-placeholder svg {
    width: 22px;
    height: 22px;
}

.mat-record-action {
    background: transparent;
    border: 0;
    color: var(--mat-brass);
    padding: 10px;
    cursor: pointer;
    font: inherit;
}

.mat-record-action:hover {
    color: var(--mat-ivory);
}


/* ==================================================
   RECORD STATUS
   ================================================== */

.mat-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    white-space: nowrap;
}

.mat-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.mat-status-review {
    color: #D9C28D;
}

.mat-status-approved {
    color: #A8C5B4;
}

.mat-status-archived {
    color: var(--mat-muted);
}


/* ==================================================
   MATERIAL RECORD DETAILS
   ================================================== */

.mat-detail-grid {
    display: grid;
    grid-template-columns:
        minmax(200px, 1fr) minmax(0, 2fr);
    gap: 24px;
}

.mat-detail-photo {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: var(--mat-charcoal);
    border: 1px solid var(--mat-border);
    border-radius: 6px;
}

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

.mat-detail-field {
    min-width: 0;
}

.mat-detail-field dt {
    color: var(--mat-muted);
    font-size: 12px;
    margin-bottom: 5px;
}

.mat-detail-field dd {
    margin: 0;
    color: var(--mat-ivory);
    font-size: 14px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.mat-detail-field-full {
    grid-column: 1 / -1;
}

.mat-metadata {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--mat-border);
    color: var(--mat-muted);
    font-size: 12px;
    line-height: 1.8;
}


/* ==================================================
   COSTING AND VALUATION
   ================================================== */

.mat-cost-input {
    width: 145px;
    max-width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    background: var(--mat-charcoal);
    border: 1px solid var(--mat-border);
    border-radius: 4px;
    color: var(--mat-ivory);
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-variant-numeric: tabular-nums;
    text-align: right;
    color-scheme: dark;
}

.mat-cost-input:focus {
    outline: 2px solid var(--mat-brass);
    outline-offset: 1px;
}

.mat-valuation-summary {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.mat-summary-item {
    padding: 20px;
    background: var(--mat-slate);
    border: 1px solid var(--mat-border);
    border-radius: 6px;
}

.mat-summary-item span {
    display: block;
    color: var(--mat-muted);
    font-size: 12px;
    margin-bottom: 10px;
}

.mat-summary-item strong {
    color: var(--mat-ivory);
    font-size: 25px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}


/* ==================================================
   CLASSIFICATION
   ================================================== */

.mat-category-list {
    display: grid;
    gap: 14px;
}

.mat-category-panel {
    border: 1px solid var(--mat-border);
    border-radius: 6px;
    background: var(--mat-slate);
    overflow: hidden;
}

.mat-category-panel summary {
    padding: 18px;
    cursor: pointer;
    color: var(--mat-ivory);
    font-size: 15px;
    font-weight: 500;
}

.mat-category-panel summary::marker {
    color: var(--mat-brass);
}

.mat-subcategory-list {
    display: grid;
    gap: 0;
    padding: 0 18px 14px;
}

.mat-subcategory-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--mat-border);
    font-size: 13px;
}


/* ==================================================
   PAGINATION
   ================================================== */

.mat-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 18px;
}

.mat-pagination span {
    color: var(--mat-muted);
    font-size: 13px;
}


/* ==================================================
   SAVE PROGRESS
   ================================================== */

.mat-progress {
    height: 5px;
    overflow: hidden;
    border-radius: 4px;
    background: var(--mat-charcoal);
    margin: 14px 0;
}

.mat-progress-bar {
    height: 100%;
    width: 0;
    background: var(--mat-brass);
    border-radius: 4px;
    transition: width 200ms ease;
}

.materials-workspace [hidden] {
    display: none !important;
}


/* ==================================================
   IPAD AND TABLET
   ================================================== */

@media (max-width: 1024px) {

    .mat-panel {
        padding: 20px;
    }

    .mat-form-grid {
        gap: 16px;
    }

    .mat-button {
        min-height: 48px;
    }

    .mat-field input,
    .mat-field select,
    .mat-search-input {
        min-height: 48px;
    }

    .mat-detail-grid {
        grid-template-columns:
            minmax(160px, 1fr) minmax(0, 2fr);
    }

    .mat-table th,
    .mat-table td {
        padding: 12px;
    }

}


/* ==================================================
   MOBILE AND SMALL SCREENS
   ================================================== */

@media (max-width: 600px) {

    .mat-panel {
        padding: 16px;
        margin-bottom: 16px;
    }

    .mat-form-grid,
    .mat-search-bar,
    .mat-detail-grid,
    .mat-detail-fields,
    .mat-valuation-summary {
        grid-template-columns: minmax(0, 1fr);
    }

    .mat-photo-zone {
        padding: 24px 14px;
    }

    .mat-photo-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .mat-photo-actions {
        flex-direction: column;
    }

    .mat-photo-actions .mat-button {
        width: 100%;
    }

    .mat-form-actions {
        flex-direction: column;
    }

    .mat-form-actions .mat-button {
        width: 100%;
    }

    .mat-toolbar-actions {
        width: 100%;
    }

    .mat-toolbar-actions .mat-button {
        flex: 1;
    }

    .mat-heading h1 {
        font-size: 25px;
    }

    .mat-section-heading h2 {
        font-size: 16px;
    }

    .mat-summary-item strong {
        font-size: 22px;
    }

}


/* ==================================================
   REDUCED MOTION
   ================================================== */

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

    .materials-workspace *,
    .materials-workspace *::before,
    .materials-workspace *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

}
