/* ====================================
   LAYOUT & WORKSPACE
   ==================================== */

/* Workspace Layout */
.workspace {
    display: flex;
    height: calc(100vh - 65px);
}

.pane {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.resize-divider {
    width: 6px;
    background: var(--border);
    cursor: col-resize;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
    user-select: none;
}

.resize-divider:hover {
    background-color: #50c878;
    box-shadow: inset 0 0 8px rgba(80, 200, 120, 0.4);
}

/* Editor Textarea */
.editor-textarea {
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    color: var(--text-main);
    border: none;
    resize: none;
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    outline: none;
}

/* Containers & Common Layout */
.container-narrow {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
    box-sizing: border-box;
}

.dashboard-container {
    min-height: 100vh;
    background: var(--bg-dark);
}

.embed-container {
    font-family: var(--font-mono);
}

.embed-overlay {
    backdrop-filter: blur(5px);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
}

@media (max-width: 768px) and (orientation: portrait) {
    .workspace {
        flex-direction: column;
        height: calc(100vh - 60px);
    }

    .pane {
        width: 100% !important;
        height: 50%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .resize-divider {
        display: flex;
        height: 16px;
        width: 100%;
        cursor: row-resize;
        touch-action: none;
        position: relative;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .resize-divider::after {
        content: "";
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 40px;
        height: 4px;
        border-radius: 2px;
        background: var(--text-muted);
    }

}

.modal-card {
    width: min(560px, 92vw);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.35);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-title {
    margin: 0 0 12px 0;
    color: var(--text-main);
    font-size: 1.1rem;
}

.modal-description {
    color: var(--text-muted);
    margin: 0 0 12px 0;
    font-size: 0.95rem;
}

.modal-body {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
}

.modal-code {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0 0 16px 0;
    width: 100%;
    min-height: 120px;
    resize: none;
}

.modal-copy-status {
    color: #22c55e;
    font-size: 0.9rem;
    margin: -6px 0 14px 0;
}

.modal-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.modal-copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Grid Utilities */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ====================================
   MOBILE LANDSCAPE OPTIMIZATIONS
   ==================================== */

/* Landscape mode: small height devices */
@media (max-height: 500px) and (orientation: landscape) {
    /* Reduce workspace height due to limited vertical space */
    .workspace {
        height: calc(100vh - 50px);
    }

    /* Make panes smaller and more compact */
    .pane {
        border-right: 1px solid var(--border);
    }

    /* Reduce terminal header size */
    .terminal-header {
        padding: 6px 12px !important;
        gap: 6px !important;
    }

    .terminal-title {
        font-size: 0.8rem !important;
    }

    .dot {
        width: 8px !important;
        height: 8px !important;
    }

    /* Reduce textarea padding */
    .editor-textarea {
        padding: 12px !important;
        font-size: 13px !important;
    }

    /* Reduce modal padding for landscape */
    .modal-card {
        padding: 16px !important;
    }

    .modal-title {
        font-size: 1rem !important;
        margin-bottom: 8px !important;
    }

    .modal-body {
        font-size: 0.9rem !important;
        margin-bottom: 12px !important;
    }

    /* Adjust markdown body for landscape */
    .markdown-body {
        padding: 12px !important;
    }

    .markdown-body h1,
    .markdown-body h2,
    .markdown-body h3 {
        margin: 8px 0 6px 0 !important;
    }

    .markdown-body p {
        margin: 6px 0 !important;
    }
}

