﻿/* ------------------------------------------
   SPLIT LAYOUT + DRAGGABLE SPLITTER
------------------------------------------- */

.tp-split-layout {
    display: grid;
    grid-template-columns: 360px 6px minmax(0, 1fr); /* sidebar | splitter | preview */
    gap: 0;
}

    /* Left panel (controls) */
    .tp-split-layout .tool-section.tool-input {
        min-width: 260px;
        max-width: 600px;
        overflow: auto;
    }

/* Draggable splitter */
.tp-splitter {
    width: 6px;
    cursor: col-resize;
    background: #e1e5ea;
    transition: background 0.15s;
}

    .tp-splitter:hover {
        background: #cdd2d8;
    }

/* Right panel (preview) */
.tp-split-layout .tool-section.tool-output {
    min-width: 0;
    overflow: visible;
}

/* Stack on small screens */
@media (max-width: 900px) {
    .tp-split-layout {
        grid-template-columns: 1fr;
    }

    .tp-splitter {
        display: none;
    }

    .tp-split-layout .tool-section.tool-input,
    .tp-split-layout .tool-section.tool-output {
        width: 100%;
        max-width: none;
    }
}

/* ------------------------------------------
   PREVIEW WRAPPER + DEVICE MODES
------------------------------------------- */

.tp-preview-wrapper {
    border-radius: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: radial-gradient(circle at top, rgba(148, 163, 184, 0.12), transparent 55%);
    padding: 0.75rem;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    overflow: visible;
    box-sizing: border-box;
}

.tp-mode-desktop {
    width: 100%;
    max-width: 100%;
}

.tp-mode-tablet {
    width: 100%;
    max-width: 900px;
}

.tp-mode-mobile {
    width: 100%;
    max-width: 420px;
}

.tp-preview-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.tp-preview-modes {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
}

.tp-mode-btn {
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: transparent;
    color: inherit;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    border-radius: 999px;
    cursor: pointer;
    margin-left: 0.25rem;
}

    .tp-mode-btn.active {
        background: rgba(148, 163, 184, 0.2);
        border-color: rgba(148, 163, 184, 0.9);
    }

/* ------------------------------------------
   THEME TOKENS
------------------------------------------- */

.tp-theme {
    --tp-primary: #6366f1;
    --tp-primary-foreground: #ffffff;
    --tp-secondary: #64748b;
    --tp-secondary-foreground: #e5e7eb;
    --tp-accent: #ec4899;
    --tp-accent-foreground: #ffffff;
    --tp-success: #22c55e;
    --tp-warning: #facc15;
    --tp-danger: #ef4444;
    --tp-bg: #0f172a;
    --tp-surface: #111827;
    --tp-surface-muted: #020617;
    --tp-border-subtle: rgba(148, 163, 184, 0.35);
    --tp-border-strong: rgba(148, 163, 184, 0.8);
    --tp-text: #e5e7eb;
    --tp-text-muted: #9ca3af;
    --tp-radius: 12px;
    --tp-space: 6px;
    --tp-shadow-elevated: 0 14px 30px rgba(15, 23, 42, 0.55);
    --tp-shadow-soft: 0 8px 18px rgba(15, 23, 42, 0.45);
    --tp-shadow-none: none;
    --tp-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --tp-font-size-base: 14px;
    color: var(--tp-text);
    background: radial-gradient(circle at top left, #1f2937, #020617);
    border-radius: 0.75rem;
    padding: calc(var(--tp-space) * 3);
    box-shadow: var(--tp-shadow-soft);
    font-family: var(--tp-font-family);
    font-size: var(--tp-font-size-base);
}

.tp-theme-light {
    --tp-bg: #f9fafb;
    --tp-surface: #ffffff;
    --tp-surface-muted: #f3f4f6;
    --tp-text: #111827;
    --tp-text-muted: #6b7280;
    background: radial-gradient(circle at top left, #e5e7eb, #f9fafb);
}

.tp-theme-dark {
    background: radial-gradient(circle at top left, #1f2937, #020617);
}

/* ------------------------------------------
   APP HEADER & LAYOUT
------------------------------------------- */

.tp-app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(120deg, rgba(15, 23, 42, 0.9), rgba(30, 64, 175, 0.9));
    border-radius: calc(var(--tp-radius) * 1.2);
    padding: calc(var(--tp-space) * 2.5);
    margin-bottom: calc(var(--tp-space) * 2.5);
    border: 1px solid rgba(129, 140, 248, 0.35);
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.6);
}

.tp-app-brand {
    display: flex;
    align-items: center;
    gap: calc(var(--tp-space) * 2);
}

.tp-app-logo {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--tp-primary), var(--tp-accent));
    color: var(--tp-primary-foreground);
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 0 0 1px rgba(191, 219, 254, 0.4), 0 12px 25px rgba(15, 23, 42, 0.7);
}

.tp-app-name {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.tp-app-subtitle {
    font-size: 0.85rem;
    color: var(--tp-text-muted);
}

.tp-app-nav {
    display: flex;
    gap: calc(var(--tp-space) * 1.5);
    flex-wrap: wrap;
}

.tp-app-main {
    display: flex;
    flex-direction: column;
    gap: calc(var(--tp-space) * 3);
}

.tp-layout {
    display: grid;
    grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
    gap: calc(var(--tp-space) * 3);
}

@media (max-width: 900px) {
    .tp-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ------------------------------------------
   SIDEBAR + NAV
------------------------------------------- */

.tp-sidebar {
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.95));
    border-radius: var(--tp-radius);
    padding: calc(var(--tp-space) * 3);
    border: 1px solid var(--tp-border-subtle);
    box-shadow: var(--tp-shadow-elevated);
}

.tp-sidebar-section + .tp-sidebar-section {
    margin-top: calc(var(--tp-space) * 3);
}

.tp-sidebar-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--tp-text-muted);
    margin-bottom: calc(var(--tp-space) * 1.5);
}

.tp-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: calc(var(--tp-space) * 1.2);
    font-size: 0.9rem;
}

    .tp-sidebar-list li {
        padding: calc(var(--tp-space) * 1.3) calc(var(--tp-space) * 1.7);
        border-radius: 999px;
        cursor: pointer;
        color: var(--tp-text-muted);
        border: 1px solid transparent;
    }

        .tp-sidebar-list li:hover {
            background: rgba(30, 64, 175, 0.3);
        }

        .tp-sidebar-list li.active {
            background: rgba(129, 140, 248, 0.2);
            color: var(--tp-text);
            border-color: rgba(129, 140, 248, 0.7);
        }

.tp-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--tp-space) * 1.2);
}

/* ------------------------------------------
   PILLS
------------------------------------------- */

.tp-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid transparent;
}

.tp-pill-success {
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(34, 197, 94, 0.6);
    color: #bbf7d0;
}

.tp-pill-warning {
    background: rgba(250, 204, 21, 0.18);
    border-color: rgba(250, 204, 21, 0.7);
    color: #fef9c3;
}

.tp-pill-danger {
    background: rgba(239, 68, 68, 0.18);
    border-color: rgba(239, 68, 68, 0.7);
    color: #fecaca;
}

.tp-pill-soft {
    background: rgba(148, 163, 184, 0.16);
    border-color: rgba(148, 163, 184, 0.45);
    color: var(--tp-text-muted);
}

/* ------------------------------------------
   CONTENT + BLOCKS
------------------------------------------- */

.tp-content {
    display: flex;
    flex-direction: column;
    gap: calc(var(--tp-space) * 2.5);
}

.tp-block {
    background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.98));
    border-radius: var(--tp-radius);
    border: 1px solid rgba(30, 64, 175, 0.4);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.65);
}

.tp-block-header {
    padding: calc(var(--tp-space) * 2) calc(var(--tp-space) * 2.5);
    border-bottom: 1px solid rgba(15, 23, 42, 0.9);
}

.tp-block-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--tp-text-muted);
}

.tp-block-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.9rem;
    color: var(--tp-text-muted);
}

.tp-block-body {
    padding: calc(var(--tp-space) * 2.5);
}

/* lower grid */
.tp-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: calc(var(--tp-space) * 2.5);
}

@media (max-width: 1000px) {
    .tp-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ------------------------------------------
   BUTTONS
------------------------------------------- */

.tp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: calc(var(--tp-radius) * 0.8);
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}

.tp-btn-sm {
    padding: 0.25rem 0.7rem;
    font-size: 0.8rem;
}

.tp-btn-primary {
    background: var(--tp-primary);
    color: var(--tp-primary-foreground);
    border-color: rgba(129, 140, 248, 0.8);
    box-shadow: 0 12px 25px rgba(56, 189, 248, 0.2);
}

    .tp-btn-primary:hover {
        background: #4f46e5;
        transform: translateY(-1px);
        box-shadow: 0 14px 28px rgba(79, 70, 229, 0.35);
    }

.tp-btn-secondary {
    background: rgba(31, 41, 55, 0.9);
    color: var(--tp-secondary-foreground);
    border-color: rgba(148, 163, 184, 0.9);
}

    .tp-btn-secondary:hover {
        background: rgba(55, 65, 81, 0.95);
    }

.tp-btn-ghost {
    background: transparent;
    color: var(--tp-text-muted);
    border-color: rgba(148, 163, 184, 0.4);
}

    .tp-btn-ghost:hover {
        background: rgba(15, 23, 42, 0.8);
        color: var(--tp-text);
        border-color: rgba(148, 163, 184, 0.8);
    }

.tp-btn-outline {
    background: transparent;
    color: var(--tp-primary-foreground);
    border-color: rgba(129, 140, 248, 0.8);
    box-shadow: none;
}

    .tp-btn-outline:hover {
        background: rgba(79, 70, 229, 0.18);
    }

.tp-btn:disabled {
    opacity: 0.5;
    cursor: default;
    box-shadow: none;
}

.tp-btn-loading {
    position: relative;
    padding-left: 0.8rem;
}

.tp-spinner {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid rgba(226, 232, 240, 0.4);
    border-top-color: rgba(226, 232, 240, 1);
    animation: tp-spin 0.9s linear infinite;
}

@keyframes tp-spin {
    to {
        transform: rotate(360deg);
    }
}

.tp-btn-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

/* ------------------------------------------
   FORM
------------------------------------------- */

.tp-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tp-form-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

    .tp-form-row.two-col {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 0.75rem;
    }

@media (max-width: 700px) {
    .tp-form-row.two-col {
        grid-template-columns: minmax(0, 1fr);
    }
}

.tp-label {
    font-size: 0.8rem;
    color: var(--tp-text-muted);
}

.tp-input {
    width: 100%;
    border-radius: calc(var(--tp-radius) * 0.7);
    border: 1px solid var(--tp-border-subtle);
    background: rgba(15, 23, 42, 0.9);
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    color: var(--tp-text);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.9);
}

    .tp-input:focus {
        outline: none;
        border-color: rgba(129, 140, 248, 0.9);
        box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.9), 0 0 0 4px rgba(79, 70, 229, 0.4);
    }

.tp-input-multiline {
    resize: vertical;
    min-height: 70px;
}

.tp-form-footer {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
}

/* Toggle */
.tp-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.tp-toggle-label {
    font-size: 0.9rem;
}

.tp-toggle {
    border: none;
    border-radius: 999px;
    padding: 0;
    width: 42px;
    height: 22px;
    position: relative;
    cursor: pointer;
    background: rgba(55, 65, 81, 0.9);
    display: inline-flex;
    align-items: center;
}

.tp-toggle-thumb {
    position: absolute;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #e5e7eb;
    box-shadow: 0 3px 6px rgba(15, 23, 42, 0.7);
    transition: transform 0.15s ease;
}

.tp-toggle-on {
    background: var(--tp-primary);
}

    .tp-toggle-on .tp-toggle-thumb {
        transform: translateX(17px);
    }

/* ------------------------------------------
   CARDS
------------------------------------------- */

.tp-card-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 0.9rem;
}

@media (max-width: 900px) {
    .tp-card-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.tp-card {
    background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.98));
    border-radius: calc(var(--tp-radius) * 0.9);
    border: 1px solid var(--tp-border-subtle);
    padding: calc(var(--tp-space) * 2.3);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    box-shadow: var(--tp-shadow-soft);
}

.tp-card-muted {
    background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.98));
}

.tp-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tp-card-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.tp-card-body-text {
    font-size: 0.9rem;
    color: var(--tp-text-muted);
    margin: 0;
}

.tp-card-footer {
    margin-top: 0.4rem;
    display: flex;
    gap: 0.5rem;
}

/* ------------------------------------------
   ALERTS
------------------------------------------- */

.tp-alert-stack {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.tp-alert {
    border-radius: calc(var(--tp-radius) * 0.8);
    padding: 0.55rem 0.7rem;
    border: 1px solid transparent;
    font-size: 0.9rem;
}

.tp-alert-title {
    font-weight: 550;
    margin-bottom: 0.1rem;
}

.tp-alert-text {
    font-size: 0.85rem;
}

.tp-alert-success {
    background: rgba(22, 163, 74, 0.16);
    border-color: rgba(34, 197, 94, 0.6);
    color: #bbf7d0;
}

.tp-alert-info {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(59, 130, 246, 0.7);
    color: #bfdbfe;
}

.tp-alert-warning {
    background: rgba(234, 179, 8, 0.18);
    border-color: rgba(245, 158, 11, 0.7);
    color: #fef9c3;
}

.tp-alert-danger {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(248, 113, 113, 0.7);
    color: #fee2e2;
}

/* ------------------------------------------
   CONTROL PANEL HELPERS
------------------------------------------- */

.tool-section.tool-input .form-group {
    margin-bottom: 1rem;
}

.tool-section.tool-input .two-col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.5rem;
}

.tool-section.tool-input .form-input-colour {
    width: 100%;
    height: 2.2rem;
    padding: 0;
    border-radius: 0.4rem;
    border: 1px solid #cbd5f5;
}

.slider-row {
    display: grid;
    grid-template-columns: 1.2fr minmax(0, 1.8fr) auto;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

    .slider-row input[type="range"] {
        width: 100%;
    }

.slider-value {
    min-width: 3.5rem;
    text-align: right;
    color: #6b7280;
}
