/* GLOBAL STYLES */

:root {
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --fast: 120ms;
    --medium: 220ms;
    --slow: 360ms;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #131416;
    color: white;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

::-webkit-scrollbar {
    display: none;
}

/* TOOLBAR STYLES */

.toolbar {
    height: 60px;
    background-color: #1D1E20;
    border-bottom: 1px solid #5f6265;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 20px;
    flex-shrink: 0;
}

.toolbar-left h1 {
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.toolbar-center {
    display: flex;
    gap: 10px;
}

.toolbar-right {
    display: flex;
    gap: 10px;
}

.toolbar-btn {
    color: white;
    padding: 8px 16px;
    outline: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(to bottom,
            hsl(225 6% 26%),
            hsl(225 6% 20%));
    border: 1px solid hsl(225 6% 30%);
    border-radius: 6px;
    transition:
        transform var(--fast) var(--ease-out),
        box-shadow var(--fast) var(--ease-out),
        background var(--fast) linear;
}

.toolbar-btn-html {
    background: #2474D8;
    border: none;
}

.toolbar-btn:hover {
    background-color: #1F2E40;
    border-color: #282A2D;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.toolbar-btn-html:hover {
    background: #184d8f;
    border: none;
}

.toolbar-btn:active {
    background-color: #d0d0d0;
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* MAIN CONTAINER & LAYOUT  */

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

/* SIDEBAR STYLES */

.sidebar {
    background-color: #242529;
    border-right: 1px solid #5f6265;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.left-sidebar {
    width: 250px;
    flex-shrink: 0;
}

.right-sidebar {
    width: 250px;
    flex-shrink: 0;
    border-right: none;
    border-left: 1px solid #5f6265;
}

.sidebar-header {
    padding: 16px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    color: #d9d9d9;
    border-bottom: 1px solid #5f6265;
    background-color: #242529;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
}

.sidebar-header-buttons {
    display: flex;
    gap: 4px;
}

.sidebar-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.sidebar-btn {
    padding: 6px 8px;
    background-color: #303033;
    border: 1px solid #4c4f54;
    border-radius: 3px;
    color: white;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-btn:hover:not(:disabled) {
    background-color: #3f3f43;
    border-color: #5a5d62;
}

.sidebar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}


/* LAYERS PANEL STYLES  */

.layers-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.layer-item {
    padding: 12px 16px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 13px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background-color: #242529;
    border-bottom: 1px solid #282A2D;
    transition:
        background-color var(--fast) var(--ease-out),
        transform var(--fast) var(--ease-out),
        padding var(--fast) var(--ease-out);
}

.layer-item:hover {
    background-color: #34363a;
    transform: translateX(2px);
}

.layer-item.selected {
    background-color: #3c4259;
    border-left: 3px solid #2196f3;
    padding-left: 13px;
    transform: translateX(4px);
}

.layer-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layer-item-controls {
    display: flex;
    gap: 4px;
}

.layer-btn {
    padding: 4px 8px;
    background-color: #303033;
    border: 1px solid #4c4f54;
    border-radius: 3px;
    color: white;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

.layer-btn:hover {
    background-color: #3f3f43;
}

.layers-empty {
    padding: 40px 16px;
    text-align: center;
    font-size: 13px;
    color: #8a8d94;
}

.layers-empty-sub {
    margin-top: 6px;
    font-size: 12px;
    opacity: 0.7;
}


/* CANVAS STYLES */

.canvas-container {
    flex: 1;
    overflow: auto;
    padding: 20px;
    background-color: #131416;
    position: relative;
}

.canvas {
    position: relative;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(to right, hsl(225 6% 25% / 0.3) 1px, transparent 1px), linear-gradient(to bottom, hsl(225 6% 25% / 0.3) 1px, transparent 1px);
    background-size: 20px 20px;
    background-color: hsl(225 6% 12%);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.canvas-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
    color: #7a7d85;
    animation: fadeUp var(--slow) var(--ease-out);
}

.canvas-empty-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.canvas-empty-sub {
    font-size: 13px;
    opacity: 0.8;
}

/* ELEMENT STYLES */

.canvas-element {
    position: absolute;
    user-select: none;
    cursor: move;
    border: 2px solid transparent;
    transition:
        box-shadow var(--fast) var(--ease-out),
        transform var(--fast) var(--ease-out),
        outline var(--fast) linear;
}

.canvas-element:hover:not(.selected) {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.canvas-element.selected {
    border: 2px solid #2196f3;
    box-shadow:
        0 0 0 1px rgba(33, 150, 243, 0.6),
        0 12px 32px rgba(0, 0, 0, 0.35);
}

.canvas-element-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.canvas-element.text-element .canvas-element-content {
    word-wrap: break-word;
    white-space: pre-wrap;
    overflow: hidden;
    text-align: center;
    color: inherit;
    font-family: Arial, sans-serif;
}


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

/* Resize handles */
.resize-handle {
    position: absolute;
    cursor: nwse-resize;
    display: none;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
    border-radius: 2px;

    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2196f3;
    border: 2px solid #0d47a1;
    transform: scale(0.8);
    opacity: 0;
    transition:
        transform var(--fast) var(--ease-out),
        opacity var(--fast) linear;
}

.canvas-element.selected .resize-handle {
    display: block;
    opacity: 1;
    transform: scale(1);
}

.resize-handle.nw {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.resize-handle.ne {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.resize-handle.sw {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.resize-handle.se {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

/* PROPERTIES PANEL STYLES */

.properties-panel {
    padding: 16px;
}

.no-selection-message {
    color: #999;
    font-size: 13px;
    text-align: center;
    padding: 24px 0;
}

.properties-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.property-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.property-label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
}

.property-input {
    background-color: #35363B;
    color: white;
    padding: 8px 12px;
    border: 1px solid #282A2D;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

.property-input:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
    transform: scale(1.02);
}

.property-color-input {
    padding: 4px;
    border: 1px solid #282A2D;
    border-radius: 4px;
    cursor: pointer;
    height: 40px;
}

.property-color-input:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.property-input,
.property-color-input {
    transition:
        border-color var(--fast) linear,
        box-shadow var(--fast) var(--ease-out),
        transform var(--fast) var(--ease-out);
}

/* shortcut panel */

.shortcut-panel {
    position: fixed;
    bottom: 16px;
    left: 16px;
    background: rgba(30, 31, 35, 0.95);
    border: 1px solid #3a3d42;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 12px;
    color: #d9d9d9;
    z-index: 9999;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    max-width: 220px;
}

.shortcut-title {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: #9aa0a6;
    margin-bottom: 8px;
}

.shortcut-panel ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.shortcut-panel li {
    display: flex;
    gap: 6px;
    align-items: center;
    line-height: 1.4;
}

.shortcut-panel kbd {
    background: #2f3136;
    border: 1px solid #4c4f54;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-family: inherit;
    color: white;
}

/* MOBILE BLOCKER */

#mobileBlocker {
    position: fixed;
    inset: 0;
    background: #131416;
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    text-align: center;
    padding: 24px;
}

.mobile-message h2 {
    font-size: 22px;
    margin-bottom: 12px;
}

.mobile-message p {
    font-size: 14px;
    opacity: 0.8;
}

@media (max-width: 700px) {
    #mobileBlocker {
        display: flex;
    }

    .toolbar,
    .main-container,
    .shortcut-panel {
        display: none !important;
    }
}