/* ==========================================
   PRIMEFORGE HISTORY
   ENTERPRISE / HIGH-CONTRAST SYSTEM
========================================== */

.history-page {

    width: auto;
    min-width: 0;
    min-height: 100vh;

    margin-left: 260px;

    padding: 28px 32px 40px;

    display: grid;

    grid-template-columns:
        minmax(260px, 330px) minmax(0, 1fr);

    gap: 1px;

    background: var(--border);

    overflow: hidden;
}


/* ==========================================
   LEFT HISTORY LIST
========================================== */

.history-list {

    min-width: 0;
    min-height: 0;

    height: calc(100vh - 56px);

    display: flex;

    flex-direction: column;

    padding: 20px;

    background: var(--surface);

    border: 1px solid var(--border);

    overflow: hidden;
}

.history-list h2 {

    margin: 0 0 16px;

    color: var(--text);

    font-size: 13px;
    line-height: 1;

    font-weight: 750;

    letter-spacing: .14em;

    text-transform: uppercase;
}


/* ==========================================
   SEARCH
========================================== */

#search {

    width: 100%;

    margin-bottom: 14px;

    padding: 11px 12px;

    background: var(--input-bg);

    color: var(--text);

    border: 1px solid var(--input-border);

    border-radius: 3px;

    outline: none;

    font-size: 12px;

    transition:
        border-color .16s ease,
        background-color .16s ease;
}

#search::placeholder {

    color: var(--subtle);
}

#search:hover {

    border-color: var(--border-strong);
}

#search:focus {

    border-color: var(--text);

    background: var(--surface-2);

    box-shadow: 0 0 0 2px var(--focus-ring);
}


/* ==========================================
   HISTORY TITLES
========================================== */

#historyTitles {

    flex: 1;

    min-height: 0;

    display: flex;

    flex-direction: column;

    gap: 1px;

    overflow-y: auto;

    background: var(--border);

    border: 1px solid var(--border);
}

#historyTitles::-webkit-scrollbar {

    width: 7px;
}

#historyTitles::-webkit-scrollbar-track {

    background: var(--surface);
}

#historyTitles::-webkit-scrollbar-thumb {

    background: var(--border-strong);

    border-radius: 0;
}

#historyTitles::-webkit-scrollbar-thumb:hover {

    background: var(--muted);
}

.history-item {

    padding: 14px;

    background: var(--surface-2);

    border: 0;

    border-radius: 0;

    cursor: pointer;

    transition:
        background-color .16s ease,
        color .16s ease;
}

.history-item:hover {

    background: var(--surface-3);

    border: 0;

    transform: none;
}

.history-item.active {

    background: var(--text);

    color: var(--bg);
}

.history-item h4 {

    margin: 0 0 6px;

    color: inherit;

    font-size: 12px;

    line-height: 1.35;

    font-weight: 650;
}

.history-item small {

    color: var(--muted);

    font-size: 9px;

    letter-spacing: .06em;
}

.history-item.active small {

    color: #666;
}


/* ==========================================
   RIGHT CONTENT
========================================== */

.history-view {

    min-width: 0;
    min-height: 0;

    height: calc(100vh - 56px);

    padding: 20px;

    background: var(--bg);

    overflow-y: auto;
}

.history-view::-webkit-scrollbar {

    width: 8px;
}

.history-view::-webkit-scrollbar-track {

    background: transparent;
}

.history-view::-webkit-scrollbar-thumb {

    background: var(--border-strong);

    border-radius: 0;
}

.history-view::-webkit-scrollbar-thumb:hover {

    background: var(--muted);
}


/* ==========================================
   HISTORY CONTENT
========================================== */

#historyContent {

    min-height: 100%;

    padding: 26px;

    background: var(--surface);

    border: 1px solid var(--border);

    border-radius: 4px;
}

#historyContent>h2 {

    margin: 0;

    color: var(--text);

    font-size: 22px;

    line-height: 1.3;

    font-weight: 700;

    letter-spacing: -.02em;
}


/* ==========================================
   RESULT
========================================== */

.result-box {

    margin-top: 24px;

    padding: 22px;

    background: var(--surface-2);

    border: 1px solid var(--border);

    border-radius: 3px;

    color: var(--text);

    white-space: pre-wrap;

    line-height: 1.8;

    font-size: 14px;

    overflow-x: auto;
}

.result-box::-webkit-scrollbar {

    width: 7px;
    height: 7px;
}

.result-box::-webkit-scrollbar-track {

    background: transparent;
}

.result-box::-webkit-scrollbar-thumb {

    background: var(--border-strong);

    border-radius: 0;
}


/* ==========================================
   ACTIONS
========================================== */

.action-buttons {

    display: flex;

    gap: 6px;

    margin-top: 18px;
}

.action-buttons button {

    padding: 10px 13px;

    border-radius: 3px;

    border: 1px solid var(--border-strong);

    cursor: pointer;

    font-size: 10px;

    font-weight: 700;

    letter-spacing: .07em;

    text-transform: uppercase;

    transition:
        background-color .16s ease,
        color .16s ease,
        border-color .16s ease;
}

.copy-btn {

    background: var(--button-bg);

    color: var(--button-text);

    border-color: var(--button-bg);
}

.copy-btn:hover {

    background: var(--button-hover);

    border-color: var(--button-hover);

    transform: none;
}

.delete-btn {

    background: transparent;

    color: var(--danger);

    border-color: var(--danger);
}

.delete-btn:hover {

    background: var(--danger);

    color: white;

    transform: none;
}


/* ==========================================
   EMPTY STATE
========================================== */

.empty-state {

    min-height: 70vh;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    text-align: center;

    padding: 40px;
}

.empty-state i {

    margin-bottom: 16px;

    color: var(--muted);

    font-size: 42px;
}

.empty-state h2 {

    color: var(--text);

    font-size: 20px;

    font-weight: 700;
}

.empty-state p {

    margin-top: 8px;

    max-width: 380px;

    color: var(--muted);

    font-size: 12px;

    line-height: 1.6;
}


/* ==========================================
   MOBILE
========================================== */

@media (max-width: 900px) {

    .history-page {

        margin-left: 0;

        padding: 20px;

        grid-template-columns: 1fr;

        background: var(--bg);

        gap: 12px;

        overflow: visible;
    }

    .history-list {

        height: auto;

        max-height: 360px;
    }

    .history-view {

        height: auto;

        min-height: 550px;

        padding: 0;
    }
}

@media (max-width: 600px) {

    .history-page {

        padding: 14px;
    }

    .history-list {

        padding: 14px;
    }

    #historyContent {

        padding: 18px;
    }

    .action-buttons {

        flex-direction: column;
    }

    .action-buttons button {

        width: 100%;
    }
}

.empty-icon {
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 42px;
    line-height: 1;
}