/* =========================================
   FLOWCHART EDITOR — PREMIUM UI
========================================= */

/* --- Page Layout --- */
.flowchart-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #0f172a;
    color: white;
}

.fc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    gap: 10px;
    z-index: 200;
}

.fc-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.fc-header-left a {
    display: flex;
    align-items: center;
}

.fc-header-left .fc-divider {
    width: 1px;
    height: 28px;
    background: #334155;
}

.fc-back-link {
    font-size: 0.85rem;
    font-weight: 700;
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
}

.fc-back-link:hover {
    color: #60a5fa;
}

.fc-header-center {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 4px;
}

.fc-toolbar-btn {
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.fc-toolbar-btn:hover {
    background: #334155;
    color: white;
}

.fc-toolbar-btn.active {
    background: #2563eb;
    color: white;
}

.fc-toolbar-sep {
    width: 1px;
    height: 20px;
    background: #334155;
}

.fc-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fc-export-btn {
    padding: 6px 14px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.fc-export-btn:hover {
    background: #334155;
    color: white;
    border-color: #475569;
}

.fc-export-btn.primary {
    background: #2563eb;
    border-color: #3b82f6;
    color: white;
}

.fc-export-btn.primary:hover {
    background: #1d4ed8;
}

/* --- Workspace --- */
.flowchart-workspace {
    display: flex;
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* --- Tool Panel (Left Sidebar) --- */
.tool-panel {
    position: relative;
    width: 52px;
    min-width: 52px;
    background: #0f172a;
    border-right: 1px solid #1e293b;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    overflow: hidden;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-panel:hover {
    width: 190px;
}

.tool-section {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #1e293b;
}

.tool-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.tool-section-title {
    font-size: 0.65rem;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0 14px;
    margin-bottom: 6px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s;
}

.tool-panel:hover .tool-section-title {
    opacity: 1;
}

.tool-btn {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    color: #94a3b8;
    width: 100%;
    transition: all 0.15s;
    white-space: nowrap;
    gap: 10px;
    border-radius: 0;
}

.tool-btn:hover {
    background: #1e293b;
    color: white;
}

.tool-btn.active {
    background: #1e3a5f;
    color: #60a5fa;
}

.tool-btn .tool-icon {
    width: 24px;
    height: 24px;
    min-width: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.tool-btn .tool-icon svg {
    width: 18px;
    height: 18px;
}

.tool-btn .tool-label {
    opacity: 0;
    transition: opacity 0.15s;
}

.tool-panel:hover .tool-btn .tool-label {
    opacity: 1;
}

/* --- SVG Canvas Area --- */
.canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    /* Dark graph paper grid */
    background-color: #0f172a;
    background-image:
        linear-gradient(rgba(51,65,85,0.3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(51,65,85,0.3) 1px, transparent 1px),
        linear-gradient(rgba(51,65,85,0.5) 2px, transparent 2px),
        linear-gradient(90deg, rgba(51,65,85,0.5) 2px, transparent 2px);
    background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
    background-position: -1px -1px, -1px -1px, -2px -2px, -2px -2px;
}

/* --- Mobile Notice --- */
.mobile-notice {
    display: none;
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: #f59e0b;
    color: #0f172a;
    border-radius: 8px;
    padding: 8px 18px;
    font-weight: 800;
    font-size: 0.85rem;
    z-index: 50;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

@media (max-width: 768px) {
    .mobile-notice {
        display: block;
    }
}

/* --- Shrunken Code Window --- */
.code-window {
    position: absolute;
    bottom: 16px;
    left: 68px;
    width: 320px;
    height: 220px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.code-window.expanded {
    width: 550px;
    height: 420px;
}

.code-header {
    background: #0f172a;
    color: #94a3b8;
    padding: 8px 14px;
    font-weight: 700;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #1e293b;
    transition: background 0.15s;
}

.code-header:hover {
    background: #1e293b;
    color: white;
}

.code-header .code-filename {
    display: flex;
    align-items: center;
    gap: 6px;
}

.code-header .code-filename::before {
    content: "";
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
}

.code-editor-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.expand-icon {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(37, 99, 235, 0.2);
    color: #60a5fa;
    width: 26px;
    height: 26px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 6px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    font-weight: 900;
    font-size: 0.75rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.15s;
}

.expand-icon:hover {
    background: rgba(37, 99, 235, 0.4);
    color: white;
}

/* --- Bottom Action Bar --- */
.bottom-bar {
    background: #0f172a;
    border-top: 1px solid #1e293b;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.bottom-info {
    color: #475569;
    font-weight: 600;
    font-size: 0.82rem;
}

.bottom-actions {
    display: flex;
    gap: 10px;
}

.bottom-actions .fc-export-btn {
    font-size: 0.78rem;
}

/* --- Zoom Indicator --- */
.zoom-indicator {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 5px 12px;
    color: #94a3b8;
    font-weight: 700;
    font-size: 0.8rem;
    z-index: 80;
    pointer-events: none;
    transition: opacity 0.3s;
}
