/* Certificate Editor Styling */
.editor-container {
    display: flex;
    flex-direction: column;
    height: 90vh;
    background: #f3f4f6;
    border-radius: 20px;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
}

/* Toolbar */
.editor-toolbar {
    background: #111827;
    color: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid #374151;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    border-right: 1px solid #374151;
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #9ca3af;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.toolbar-btn.active {
    background: #7c3aec;
    color: white;
}

.toolbar-select {
    background: #1f2937;
    color: white;
    border: 1px solid #374151;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
}

/* Sidebar */
.editor-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.editor-sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-section {
    padding: 1.5rem;
    border-bottom: 1px solid #f3f4f6;
}

.section-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.tool-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.tool-item {
    background: #7c3aec;
    color: white;
    padding: 0.85rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: transform 0.2s;
}

.tool-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(124, 58, 237, 0.3);
}

.placeholder-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.placeholder-item {
    padding: 0.6rem 0.75rem;
    background: #f9fafb;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #475569;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.placeholder-item:hover {
    background: #f5f3ff;
    border-color: #ddd6fe;
    color: #7c3aec;
}

/* Canvas Area */
.editor-canvas-container {
    flex: 1;
    background: #f3f4f6;
    padding: 3rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: auto;
    position: relative;
}

.certificate-canvas {
    background: white;
    width: 800px; /* Base width */
    height: 565px; /* Approx A4 Landscape ratio */
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.canvas-element {
    position: absolute;
    cursor: move;
    user-select: none;
    padding: 5px;
    border: 1px solid transparent;
}

.canvas-element[contenteditable="true"] {
    user-select: text;
    cursor: text;
}

.canvas-element:hover {
    border: 1px dashed #7c3aec;
}

.canvas-element.selected {
    border: 2px solid #7c3aec;
}

.qr-placeholder {
    width: 80px;
    height: 80px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3af;
    font-size: 2rem;
}

/* Resizers */
.resizer {
    width: 8px;
    height: 8px;
    background: #7c3aec;
    position: absolute;
    border-radius: 50%;
    display: none;
}

.canvas-element.selected .resizer {
    display: block;
}

/* Resizers & Rotator */
.resizer {
    width: 10px;
    height: 10px;
    background: #7c3aec;
    position: absolute;
    border-radius: 50%;
    display: none;
    border: 2px solid white;
}

.rotator {
    width: 12px;
    height: 12px;
    background: #10b981;
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50%;
    display: none;
    border: 2px solid white;
    cursor: grab;
}

.rotator::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 18px;
    background: #10b981;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
}

.canvas-element.selected .resizer,
.canvas-element.selected .rotator {
    display: block;
}

.resizer-tl { top: -5px; left: -5px; cursor: nw-resize; }
.resizer-tr { top: -5px; right: -5px; cursor: ne-resize; }
.resizer-bl { bottom: -5px; left: -5px; cursor: sw-resize; }
.resizer-br { bottom: -5px; right: -5px; cursor: se-resize; }

.layer-btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
    background: #374151;
    border: none;
    color: #9ca3af;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.layer-btn:hover {
    background: #4b5563;
    color: white;
}
.editor-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .editor-sidebar {
        position: fixed;
        left: -300px;
        top: 60px;
        bottom: 0;
        z-index: 100;
        transition: left 0.3s ease;
    }
    .editor-sidebar.active {
        left: 0;
    }
    .mobile-toggle {
        display: block !important;
    }
    .editor-toolbar {
        overflow-x: auto;
        justify-content: flex-start;
        padding: 0.75rem 1rem;
    }
    .toolbar-group {
        flex-shrink: 0;
    }
}
