/* ═══════════════════════════════════════
   TeraPrint Image Editor (C5)
   Branding: #337ab7 primary, #f36f21 CTA,
   #2d2d2d text, border-radius: 0, Roboto
   ═══════════════════════════════════════ */

.tp-editor-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(45, 45, 45, 0.85);
    z-index: 100000;
    justify-content: center;
    align-items: center;
}

.tp-editor-overlay--visible {
    display: flex;
}

.tp-editor-modal {
    background: #fff;
    width: 90vw;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    box-shadow: 0 4px 24px rgba(45, 45, 45, 0.3);
    overflow: hidden;
}

/* ── Header ── */
.tp-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #e8e8e8;
    background: #337ab7;
    color: #fff;
    flex-shrink: 0;
}

.tp-editor-title {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: #fff;
}

.tp-editor-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
    opacity: 0.9;
    transition: opacity 0.15s;
}

.tp-editor-close:hover {
    opacity: 1;
}

/* ── Body ── */
.tp-editor-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tp-editor-canvas {
    flex: 1;
    min-height: 250px;
    max-height: 60vh;
    background: #f5f5f5;
    overflow: hidden;
    position: relative;
}

.tp-editor-canvas img {
    display: block;
    max-width: 100%;
}

/* ── Toolbar ── */
.tp-editor-toolbar {
    display: flex;
    gap: 20px;
    padding: 12px 20px;
    border-top: 1px solid #e8e8e8;
    flex-wrap: wrap;
    flex-shrink: 0;
    background: #fafafa;
}

.tp-editor-tool-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tp-editor-tool-label {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #2d2d2d;
    margin-right: 4px;
    white-space: nowrap;
}

/* ── Buttons (shared) ── */
.tp-editor-btn {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    border: 1px solid #ccc;
    background: #fff;
    color: #2d2d2d;
    cursor: pointer;
    border-radius: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    line-height: 1.4;
}

.tp-editor-btn:hover {
    background: #f0f0f0;
    border-color: #337ab7;
}

.tp-editor-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tp-editor-btn--active {
    background: #337ab7;
    color: #fff;
    border-color: #337ab7;
}

.tp-editor-btn--active:hover {
    background: #2c6ba0;
    border-color: #2c6ba0;
}

.tp-editor-btn--primary {
    background: #f36f21;
    color: #fff;
    border-color: #f36f21;
    font-weight: 600;
    padding: 8px 20px;
}

.tp-editor-btn--primary:hover {
    background: #e0601a;
    border-color: #e0601a;
}

.tp-editor-btn--primary:disabled {
    background: #f3a06e;
    border-color: #f3a06e;
}

.tp-editor-btn--secondary {
    background: #fff;
    color: #2d2d2d;
    border-color: #ccc;
    padding: 8px 16px;
}

.tp-editor-btn--secondary:hover {
    background: #f5f5f5;
    border-color: #999;
}

/* ── Footer ── */
.tp-editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #e8e8e8;
    flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .tp-editor-modal {
        width: 100vw;
        max-width: 100vw;
        max-height: 100vh;
        height: 100vh;
    }

    .tp-editor-toolbar {
        flex-direction: column;
        gap: 10px;
        padding: 10px 16px;
    }

    .tp-editor-tool-group {
        flex-wrap: wrap;
    }

    .tp-editor-footer {
        flex-wrap: wrap;
        padding: 12px 16px;
    }

    .tp-editor-btn--primary,
    .tp-editor-btn--secondary {
        flex: 1;
        text-align: center;
        min-width: 0;
    }

    .tp-editor-header {
        padding: 12px 16px;
    }

    .tp-editor-canvas {
        min-height: 200px;
    }
}

@media (max-width: 480px) {
    .tp-editor-footer {
        flex-direction: column;
    }

    .tp-editor-btn--primary,
    .tp-editor-btn--secondary {
        width: 100%;
    }
}
