/**
 * LAYOUT STYLES
 * Photoshop-like editor layout with toolbar, canvas, and panels
 */

/* ===================================================
   MAIN LAYOUT
   =================================================== */

.editor-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: calc(100vh - 60px); /* Account for menu bar and status bar */
    margin-top: 30px; /* Space for menu bar */
    background: #2a2a2a;
}

/* ===================================================
   MENU BAR
   =================================================== */

.menu-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: #3c3c3c;
    display: flex;
    align-items: center;
    padding: 0 10px;
    z-index: 1000;
    border-bottom: 1px solid #222;
}

.menu-item {
    position: relative;
    padding: 5px 15px;
    color: #ddd;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.menu-item:hover {
    background: #4a4a4a;
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #3c3c3c;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border: 1px solid #222;
    z-index: 1001;
}

.menu-item:hover .menu-dropdown {
    display: block;
}

.menu-action {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 8px 15px;
    border: none;
    background: none;
    color: #ddd;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.menu-action:hover {
    background: #4a90d9;
}

.menu-action .shortcut {
    color: #888;
    font-size: 11px;
}

.menu-divider {
    height: 1px;
    background: #555;
    margin: 5px 0;
}

/* ===================================================
   LEFT TOOLBAR
   =================================================== */

.editor-toolbar {
    width: 50px;
    background: #3c3c3c;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 5px;
    gap: 5px;
    border-right: 1px solid #222;
}

.tool-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #ccc;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.tool-btn:hover {
    background: #4a4a4a;
    color: #fff;
}

.tool-btn.active {
    background: #4a90d9;
    color: #fff;
}

.tool-divider {
    width: 30px;
    height: 1px;
    background: #555;
    margin: 5px 0;
}

.tool-color-picker {
    position: relative;
    width: 36px;
    height: 36px;
    margin-top: auto;
}

.color-swatch {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-radius: 2px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.color-swatch.foreground {
    top: 0;
    left: 0;
    z-index: 2;
}

.color-swatch.background {
    bottom: 0;
    right: 0;
    z-index: 1;
}

/* ===================================================
   CANVAS AREA
   =================================================== */

.canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1e1e1e;
    overflow: hidden;
    position: relative;
}

.canvas-viewport {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.canvas-wrapper {
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.editor-canvas {
    position: absolute;
    top: 0;
    left: 0;
}

#display-canvas {
    position: relative;
    z-index: 1;
}

#tool-canvas {
    z-index: 2;
    pointer-events: none;
}

#control-canvas {
    z-index: 3;
    pointer-events: none;
}

.canvas-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px;
    background: #3c3c3c;
    border-top: 1px solid #222;
}

.canvas-control-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #4a4a4a;
    color: #ccc;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-control-btn:hover {
    background: #5a5a5a;
    color: #fff;
}

.zoom-level {
    color: #ccc;
    font-size: 12px;
    min-width: 50px;
    text-align: center;
}

/* ===================================================
   RIGHT PANEL
   =================================================== */

.editor-right-panel {
    width: 280px;
    background: #3c3c3c;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #222;
}

/* ===================================================
   LAYER PANEL
   =================================================== */

.layer-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
    border-bottom: 1px solid #222;
}

.layer-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #333;
    border-bottom: 1px solid #222;
}

.layer-panel-header h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.layer-panel-actions {
    display: flex;
    gap: 5px;
}

.layer-action-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: #4a4a4a;
    color: #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-action-btn:hover {
    background: #5a5a5a;
    color: #fff;
}

.layer-list {
    flex: 1;
    overflow-y: auto;
    padding: 5px;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #4a4a4a;
    border-radius: 4px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.layer-item:hover {
    background: #555;
}

.layer-item.active {
    background: #4a90d9;
}

.layer-item.dragging {
    opacity: 0.5;
}

.layer-item.drag-over {
    border-top: 2px solid #4a90d9;
}

.layer-visibility-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
}

.layer-visibility-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.layer-visibility-btn.hidden {
    color: #666;
}

.layer-thumbnail {
    width: 40px;
    height: 30px;
    background: #333;
    background-size: cover;
    background-position: center;
    border: 1px solid #555;
    border-radius: 2px;
}

.layer-name {
    flex: 1;
    color: #ddd;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.layer-reorder-btns {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.layer-reorder-btn {
    width: 18px;
    height: 14px;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
}

.layer-reorder-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.layer-panel-footer {
    padding: 10px;
    background: #333;
    border-top: 1px solid #222;
}

.layer-opacity-control,
.layer-blend-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.layer-opacity-control:last-child,
.layer-blend-control:last-child {
    margin-bottom: 0;
}

.layer-opacity-control label,
.layer-blend-control label {
    color: #999;
    font-size: 11px;
    min-width: 50px;
}

.layer-opacity-control input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    background: #555;
    border-radius: 2px;
}

.layer-opacity-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}

#layer-opacity-value {
    color: #ccc;
    font-size: 11px;
    min-width: 35px;
    text-align: right;
}

#layer-blend-select {
    flex: 1;
    background: #4a4a4a;
    border: 1px solid #555;
    color: #ccc;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
}

#layer-blend-select:focus {
    outline: none;
    border-color: #4a90d9;
}

/* ===================================================
   PROPERTIES PANEL
   =================================================== */

.properties-panel {
    flex: 0 0 auto;
    max-height: 250px;
    overflow-y: auto;
}

.properties-panel h3 {
    margin: 0;
    padding: 10px;
    font-size: 12px;
    font-weight: 600;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #333;
    border-bottom: 1px solid #222;
}

.properties-content {
    padding: 10px;
}

.properties-hint {
    color: #666;
    font-size: 12px;
    text-align: center;
    margin: 20px 0;
}

/* ===================================================
   STATUS BAR
   =================================================== */

.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: #3c3c3c;
    display: flex;
    align-items: center;
    padding: 0 15px;
    gap: 20px;
    border-top: 1px solid #222;
    z-index: 1000;
}

.status-bar span {
    color: #999;
    font-size: 11px;
}

.status-dimensions {
    min-width: 80px;
}

.status-cursor {
    min-width: 100px;
}

.status-tool {
    flex: 1;
}

.status-memory {
    color: #666 !important;
}

/* ===================================================
   SCROLLBARS
   =================================================== */

.layer-list::-webkit-scrollbar,
.canvas-viewport::-webkit-scrollbar,
.properties-panel::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.layer-list::-webkit-scrollbar-track,
.canvas-viewport::-webkit-scrollbar-track,
.properties-panel::-webkit-scrollbar-track {
    background: #2a2a2a;
}

.layer-list::-webkit-scrollbar-thumb,
.canvas-viewport::-webkit-scrollbar-thumb,
.properties-panel::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.layer-list::-webkit-scrollbar-thumb:hover,
.canvas-viewport::-webkit-scrollbar-thumb:hover,
.properties-panel::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* ===================================================
   RESPONSIVE (for smaller screens)
   =================================================== */

@media (max-width: 1024px) {
    .editor-right-panel {
        width: 240px;
    }
}

@media (max-width: 768px) {
    .editor-right-panel {
        display: none;
    }

    .editor-toolbar {
        width: 44px;
    }

    .tool-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* ===================================================
   TOOL SETTINGS PANELS
   =================================================== */

.tool-settings-panel {
    padding: 5px 0;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.settings-row label {
    color: #999;
    font-size: 11px;
    min-width: 60px;
}

.settings-row input[type="range"] {
    flex: 1;
    min-width: 80px;
    height: 4px;
    -webkit-appearance: none;
    background: #555;
    border-radius: 2px;
}

.settings-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}

.settings-row input[type="number"] {
    width: 60px;
    background: #4a4a4a;
    border: 1px solid #555;
    color: #ccc;
    padding: 4px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.settings-row input[type="color"] {
    width: 30px;
    height: 24px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
}

.settings-row select {
    flex: 1;
    background: #4a4a4a;
    border: 1px solid #555;
    color: #ccc;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
}

.settings-row select:focus {
    outline: none;
    border-color: #4a90d9;
}

.mode-btn,
.style-btn {
    padding: 4px 10px;
    border: 1px solid #555;
    background: #4a4a4a;
    color: #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.15s ease;
}

.mode-btn:hover,
.style-btn:hover {
    background: #5a5a5a;
    color: #fff;
}

.mode-btn.active,
.style-btn.active {
    background: #4a90d9;
    border-color: #4a90d9;
    color: #fff;
}

.primary-btn {
    flex: 1;
    padding: 8px 12px;
    background: #4a90d9;
    border: none;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.15s ease;
}

.primary-btn:hover {
    background: #5a9de9;
}

.secondary-btn {
    padding: 8px 12px;
    background: #4a4a4a;
    border: 1px solid #555;
    color: #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s ease;
}

.secondary-btn:hover {
    background: #5a5a5a;
    color: #fff;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.preset-btn {
    padding: 4px 8px;
    background: #4a4a4a;
    border: 1px solid #555;
    color: #ccc;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.15s ease;
}

.preset-btn:hover {
    background: #5a5a5a;
    color: #fff;
}

.hint {
    color: #666;
    font-size: 11px;
    font-style: italic;
    margin: 5px 0;
}

.filter-sliders {
    max-height: 200px;
    overflow-y: auto;
}

/* ===================================================
   MODALS
   =================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #3c3c3c;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #333;
    border-bottom: 1px solid #222;
}

.modal-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: #fff;
}

.modal-header h2 i {
    margin-right: 10px;
    color: #4a90d9;
}

.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    color: #ccc;
    margin: 0 0 15px 0;
    font-size: 14px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    background: #333;
    border-top: 1px solid #222;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-btn.primary {
    background: #4a90d9;
    border: none;
    color: #fff;
}

.modal-btn.primary:hover {
    background: #5a9de9;
}

.modal-btn.secondary {
    background: #4a4a4a;
    border: 1px solid #555;
    color: #ccc;
}

.modal-btn.secondary:hover {
    background: #5a5a5a;
    color: #fff;
}

.modal-error {
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid #ff4444;
    color: #ff6666;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 13px;
}

.modal-hint {
    color: #666 !important;
    font-size: 12px !important;
    text-align: center;
    margin-top: 15px !important;
}

/* Welcome Modal */
.welcome-modal {
    width: 450px;
}

.welcome-options {
    display: flex;
    gap: 15px;
    margin: 20px 0;
}

.welcome-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 25px 15px;
    background: #4a4a4a;
    border: 2px solid #555;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.welcome-btn:hover {
    background: #555;
    border-color: #4a90d9;
    transform: translateY(-2px);
}

.welcome-btn i {
    font-size: 32px;
    color: #4a90d9;
}

.welcome-btn span {
    font-size: 16px;
    font-weight: 500;
    color: #fff;
}

.welcome-btn small {
    font-size: 12px;
    color: #888;
}

/* New Document Modal */
.new-doc-modal {
    width: 400px;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.form-row label {
    min-width: 80px;
    color: #999;
    font-size: 13px;
}

.form-row input[type="number"] {
    width: 100px;
    padding: 8px 10px;
    background: #4a4a4a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
}

.form-row input[type="number"]:focus {
    outline: none;
    border-color: #4a90d9;
}

.form-row select {
    flex: 1;
    padding: 8px 10px;
    background: #4a4a4a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #ccc;
    font-size: 13px;
    cursor: pointer;
}

.form-row select:focus {
    outline: none;
    border-color: #4a90d9;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    flex: 1;
}

.size-preset {
    padding: 8px 10px;
    background: #4a4a4a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #ccc;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.size-preset:hover {
    background: #555;
    border-color: #4a90d9;
    color: #fff;
}

.size-preset.active {
    background: #4a90d9;
    border-color: #4a90d9;
    color: #fff;
}
