/* ==========================================
   PRIMEFORGE AI WORKSPACE
   ENTERPRISE / HIGH-CONTRAST SYSTEM
========================================== */

.workspace-page {

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

    margin-left: 260px;

    padding: 28px 32px 40px;

    overflow-x: hidden;
    overflow-y: auto;
}


/* ==========================================
   MAIN WORKSPACE GRID
========================================== */

.workspace-grid {

    display: grid;

    grid-template-columns:
        minmax(360px, 0.78fr) minmax(520px, 1.22fr);

    gap: 18px;

    width: 100%;

    max-width: 1600px;

    margin: 0 auto;
}


/* ==========================================
   PRIMARY PANELS
========================================== */

.workspace-form,
.workspace-output {

    min-width: 0;

    background: var(--surface);

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

    border-radius: 4px;

    box-shadow: none;

    overflow: hidden;
}


/* ==========================================
   LEFT / FORM PANEL
========================================== */

.workspace-form {

    min-height: 720px;

    padding: 24px;

    display: flex;

    flex-direction: column;
}


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

.workspace-header {

    padding-bottom: 18px;

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

.workspace-header h1 {

    margin: 0;

    color: var(--text);

    font-size: 28px;

    line-height: 1.2;

    font-weight: 700;

    letter-spacing: -.025em;
}

.workspace-header p {

    width: 100%;
    max-width: 620px;

    margin-top: 9px;

    margin-bottom: 0;

    color: var(--muted);

    font-size: 12px;

    line-height: 1.65;
}

.workspace-divider {

    display: none;
}


/* ==========================================
   SELECTED TOOL
========================================== */

.selected-tool {

    margin: 16px 0 18px;
}

#selectedToolBadge {

    display: inline-flex;

    align-items: center;

    gap: 7px;

    padding: 5px 8px;

    background: var(--surface-2);

    color: var(--text);

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

    border-radius: 2px;

    font-size: 10px;

    line-height: 1;

    font-weight: 700;

    letter-spacing: .08em;

    text-transform: uppercase;

    box-shadow: none;
}


/* ==========================================
   FORM CONTAINER
========================================== */

.workspace-card {

    min-height: 0;

    background: transparent;

    border: 0;

    border-radius: 0;

    padding: 0;
}

#dynamicForm {

    flex: 1;

    min-height: 0;

    overflow-y: auto;

    padding-right: 8px;
}

#dynamicForm::-webkit-scrollbar {

    width: 7px;
}

#dynamicForm::-webkit-scrollbar-track {

    background: transparent;
}

#dynamicForm::-webkit-scrollbar-thumb {

    background: var(--border-strong);

    border-radius: 0;
}

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

    background: var(--muted);
}


/* ==========================================
   FORM LABELS
========================================== */

.workspace-form label {

    display: block;

    margin-top: 20px;

    margin-bottom: 7px;

    color: var(--muted);

    font-size: 10px;

    line-height: 1.2;

    font-weight: 700;

    letter-spacing: .13em;

    text-transform: uppercase;
}


/* ==========================================
   INPUTS
========================================== */

.workspace-form input,
.workspace-form textarea,
.workspace-form select {

    width: 100%;

    padding: 12px 13px;

    background: var(--input-bg);

    color: var(--text);

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

    border-radius: 3px;

    outline: none;

    font-size: 13px;

    line-height: 1.5;

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

.workspace-form textarea {

    min-height: 130px;

    resize: vertical;
}

.workspace-form input::placeholder,
.workspace-form textarea::placeholder {

    color: var(--subtle);
}

.workspace-form input:hover,
.workspace-form textarea:hover,
.workspace-form select:hover {

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

.workspace-form input:focus,
.workspace-form textarea:focus,
.workspace-form select:focus {

    border-color: var(--text);

    background: var(--surface-2);

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


/* ==========================================
   GENERATE ACTION
========================================== */

.generate-section {

    flex-shrink: 0;

    margin-top: 18px;

    padding-top: 18px;

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

#generateBtn {

    width: 100%;

    padding: 12px 14px;

    background: var(--button-bg);

    color: var(--button-text);

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

    border-radius: 3px;

    cursor: pointer;

    font-size: 11px;

    font-weight: 700;

    letter-spacing: .08em;

    text-transform: uppercase;

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

#generateBtn:hover {

    background: var(--button-hover);

    color: var(--button-text);

    transform: none;

    box-shadow: none;
}

#generateBtn:disabled {

    opacity: .55;

    cursor: not-allowed;

}


/* ==========================================
   OUTPUT PANEL
========================================== */

.workspace-output {

    /* Match the height of the form panel while keeping #result as the only
       scrolling surface. The grid row determines the shared panel height. */
    height: auto;
    max-height: none;
    min-height: 0;

    align-self: stretch;

    display: flex;
    flex-direction: column;
}


/* ==========================================
   OUTPUT HEADER
========================================== */

.output-header {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 18px;

    padding: 18px 20px;

    background: var(--surface-2);

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

.output-header h2 {

    margin: 0;

    color: var(--text);

    font-size: 12px;

    line-height: 1;

    font-weight: 750;

    letter-spacing: .15em;

    text-transform: uppercase;
}


/* ==========================================
   OUTPUT TOOLBAR
========================================== */

.output-tools {

    display: flex;

    align-items: center;

    gap: 4px;

    flex-wrap: wrap;
}

.output-tools button {

    min-height: 32px;

    padding: 7px 10px;

    background: transparent;

    color: var(--muted);

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

    border-radius: 2px;

    cursor: pointer;

    font-size: 10px;

    font-weight: 650;

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

.output-tools button:hover {

    background: var(--surface-3);

    color: var(--text);

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

    transform: none;

    box-shadow: none;
}


/* ==========================================
   AI STATUS
========================================== */

.ai-status {

    display: flex;

    align-items: center;

    gap: 9px;

    min-height: 38px;

    padding: 0 20px;

    background: var(--surface);

    color: var(--muted);

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

    font-size: 10px;

    font-weight: 650;

    letter-spacing: .07em;

    text-transform: uppercase;
}

.status-dot {

    width: 6px;

    height: 6px;

    flex: 0 0 6px;

    background: var(--text);

    border-radius: 50%;

    animation:
        workspacePulse 1.6s ease-in-out infinite;
}

@keyframes workspacePulse {

    0%,
    100% {
        opacity: .35;
    }

    50% {
        opacity: 1;
    }
}


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

#result {

    /* This is the only scrolling surface inside the output panel. */
    flex: 1 1 auto;
    min-height: 0;
    height: 0;

    padding: 24px;

    overflow-y: auto;
    overflow-x: hidden;

    color: var(--text);

    font-size: 14px;

    line-height: 1.8;

    overflow-wrap: anywhere;
    word-break: break-word;

    /* Keep scrolling functional without showing a scrollbar. */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#result::-webkit-scrollbar {

    width: 0;
    height: 0;
}

#result::-webkit-scrollbar-track,
#result::-webkit-scrollbar-thumb {

    background: transparent;
}


/* ==========================================
   GENERATED CONTENT TYPOGRAPHY
========================================== */

#result h1,
#result h2,
#result h3 {

    margin-top: 26px;

    margin-bottom: 12px;

    color: var(--text);

    font-weight: 700;
}

#result h1:first-child,
#result h2:first-child,
#result h3:first-child {

    margin-top: 0;
}

#result p {

    margin-bottom: 16px;
}

#result ul,
#result ol {

    margin: 16px 0;

    padding-left: 24px;
}

#result li {

    margin-bottom: 8px;
}

#result strong {

    color: var(--text);
}

#result code {

    padding: 2px 5px;

    background: var(--surface-3);

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

    border-radius: 2px;

    color: var(--text);
}


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

.result-stats {

    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 1px;

    background: var(--border);

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

.stat-card {

    min-width: 0;

    min-height: 88px;

    padding: 16px;

    background: var(--surface-2);

    border: 0;

    border-radius: 0;

    text-align: left;

    transition:
        background-color .16s ease;
}

.stat-card:hover {

    background: var(--surface-3);

    border-color: transparent;

    transform: none;

    box-shadow: none;
}

.stat-card span {

    display: block;

    margin-bottom: 12px;

    color: var(--muted);

    font-size: 9px;

    line-height: 1;

    font-weight: 650;

    letter-spacing: .11em;

    text-transform: uppercase;
}

.stat-card strong {

    display: block;

    color: var(--text);

    font-size: 19px;

    line-height: 1.2;

    font-weight: 700;
}


/* ==========================================
   RESPONSIVE
========================================== */

@media (max-width: 1100px) {

    .workspace-grid {

        grid-template-columns: 1fr;
    }

    .workspace-form {

        min-height: 600px;
    }

    .workspace-output {

        height: 600px;
        max-height: 600px;
    }
}

@media (max-width: 900px) {

    .workspace-page {

        margin-left: 0;

        padding: 22px 18px 32px;
    }
}

@media (max-width: 700px) {

    .workspace-grid {

        gap: 12px;
    }

    .workspace-form {

        padding: 18px;
    }

    .workspace-output {

        height: 600px;
        max-height: calc(100vh - 44px);
    }

    .output-header {

        flex-direction: column;

        align-items: stretch;
    }

    .output-tools {

        width: 100%;
    }

    .output-tools button {

        flex: 1;
    }

    .result-stats {

        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }
}
/* ==========================================
   GENERATED MEDIA RESULTS
========================================== */

.generated-media {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #000;
}

.generated-image {
    height: auto;
    max-height: 100%;
    object-fit: contain;
}

.generated-video {
    max-height: 100%;
    object-fit: contain;
}

.generated-audio-wrap {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
}

.generated-audio-icon {
    font-size: 56px;
}

.generated-audio {
    width: min(100%, 620px);
}


.video-coming-soon {
    max-width: 560px;
    margin: 24px auto;
    padding: 28px;
    border: 1px solid rgba(120, 150, 190, 0.35);
    border-radius: 16px;
    text-align: center;
}

.video-coming-soon h3 {
    margin: 0 0 12px;
}

.video-coming-soon p {
    line-height: 1.6;
}

.video-coming-soon-note {
    font-size: 0.92rem;
    opacity: 0.8;
}
