
/* =====================================================
   ROOT WRAPPER
===================================================== */

.tool-wrapper {
    --split: 50%;

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

    margin: 0 auto;

    border: 1px solid #e5e7eb;
    border-radius: 16px;

    overflow: hidden;

    background: white;
}

.dark .tool-wrapper {
    background: #0f172a;
    border-color: #1f2937;
}


/* =====================================================
   TOOL CARD (MAIN CONTAINER)
===================================================== */

#tool-card {
    display: flex;
    flex-direction: column;

    height: 80vh;
    min-height: 500px;

    overflow: hidden;
}


/* =====================================================
   STATUS BAR (TOP)
===================================================== */

#tool-card .grid {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 10px;

    padding: 12px 16px;

    border-bottom: 1px solid #e5e7eb;

    color: #6b7280;
}

.dark #preview-frame {
    border-color: #1f2937;
    background: #0f172a;
}


/* =====================================================
   VIEWER GRID (CORE LAYOUT)
===================================================== */

#split-container {
    display: grid;

    flex: 1;
    min-height: 0;

    overflow: hidden;
}


/* SIDE MODE */
#split-container.side {
    grid-template-columns: var(--split) 8px 1fr;
    grid-template-rows: 1fr;
}

/* STACK MODE */
#split-container.stack {
    grid-template-columns: 1fr;
    grid-template-rows: var(--split) 8px 1fr;
}


/* =====================================================
   PANES
===================================================== */

#editor-pane,
#preview-pane {
    min-height: 0;
    min-width: 0;

    display: flex;
    flex-direction: column;

    overflow: hidden;
}


/* =====================================================
   EDITOR AREA
===================================================== */

#input {
    width: 100%;
    height: 100%;

    flex: 1;

    font-family: ui-monospace, monospace;
    font-size: 14px;

    padding: 16px;

    border: 1px solid #e5e7eb;
    border-radius: 12px;

    background: #f8fafc;

    resize: none;

    overflow: auto;
}

.dark #input {
    background: #020617;
    border-color: #1f2937;
    color: #e5e7eb;
}


/* =====================================================
   PREVIEW FRAME
===================================================== */

#preview-frame {
    width: 100%;
    height: 100%;

    border: 1px solid #e5e7eb;
    border-radius: 12px;

    background: #ffffff;

    flex: 1;
}

.dark #preview-frame {
    background: #0f172a;
}

/* =====================================================
   SPLITTER BAR
===================================================== */

#dragbar {
    background: #e5e7eb;

    transition: background 0.15s ease;

    cursor: col-resize;
}

/* vertical mode */
#split-container.side #dragbar {
    width: 8px;
    cursor: col-resize;
}

/* horizontal mode */
#split-container.stack #dragbar {
    height: 8px;
    width: 100%;
    cursor: row-resize;
}

#dragbar:hover {
    background: #9333ea;
}

.dark #dragbar {
    background: #1f2937;
}

.dark #dragbar:hover {
    background: #9333ea;
}


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

button {
    font-family: inherit;
}

#tool-card button {
    border-radius: 10px;
    transition: all 0.15s ease;
}

#tool-card button:hover {
    transform: translateY(-1px);
}


/* =====================================================
   MODAL (FULLSCREEN PREVIEW)
===================================================== */

:root {
    --modal-header-bg: #f1f5f9;
    --modal-header-text: #1e293b;
    --modal-header-btn-border: #cbd5e1;
    --modal-header-btn-hover: #e2e8f0;
}

.dark {
    --modal-header-bg: #111827;
    --modal-header-text: #ffffff;
    --modal-header-btn-border: rgba(255, 255, 255, 0.2);
    --modal-header-btn-hover: rgba(255, 255, 255, 0.1);
}

.viewer-modal {
    width: min(1400px, 96vw);
    height: 92vh;
    padding: 0;
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.4);
}

.viewer-modal::backdrop {
    background: rgba(0, 0, 0, 0.6);
}

.viewer-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 16px;
    font-family: ui-monospace, monospace;
    font-size: 13px;
    background: var(--modal-header-bg);
    color: var(--modal-header-text);
    border-bottom: 1px solid var(--modal-header-btn-border);
}

.viewer-modal__header button {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--modal-header-btn-border);
    color: var(--modal-header-text);
    cursor: pointer;
}

.viewer-modal__header button:hover {
    background: var(--modal-header-btn-hover);
}

.viewer-modal__frame {
    width: 100%;
    height: calc(100% - 52px);
    border: none;
    background: white;
}


/* =====================================================
   TOOL WRAPPER RESET (IMPORTANT)
===================================================== */

html,
body {
    height: auto;
    overflow-x: hidden;
}