/* studio.css */

/* .studio-layout (app shell) */
.studio-layout {
    background-color: rgb(var(--color-surface, 248 250 252));
    color: rgb(var(--color-text, 15 23 42));
    font-family: var(--font-body, system-ui, sans-serif);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: color 0.3s, background-color 0.3s;
}

[data-theme="dark"] .studio-layout,
html.dark .studio-layout {
    --color-surface: 15 23 42;
    --color-text: 248 250 252;
}

/* .studio-toolbar (top toolbar) */
.studio-toolbar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0.75rem 0;
    background: rgba(var(--color-bg, 255 255 255), 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgb(var(--color-border, 226 232 240));
    transition: color 0.3s, background-color 0.3s;
}

.studio-toolbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.studio-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    z-index: 20;
}

.studio-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* .studio-sidebar (left/right panels) */
.studio-sidebar {
    width: 100%;
    height: 45vh;
    background-color: rgb(var(--color-bg, 255 255 255));
    border-top: 1px solid rgb(var(--color-border, 226 232 240));
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    z-index: 10;
    overflow: hidden;
    flex-shrink: 0;
    min-height: 0;
}

@media(min-width: 768px) {
    .studio-sidebar {
        width: 20rem;
        height: 100%;
        border-top: 0;
        border-right: 1px solid rgb(var(--color-border, 226 232 240));
    }
}

.studio-sidebar-tabs {
    display: flex;
    border-bottom: 1px solid rgb(var(--color-border, 226 232 240));
    flex-shrink: 0;
    overflow-x: auto;
}
.studio-sidebar-tabs::-webkit-scrollbar {
    display: none;
}

.studio-sidebar-tab {
    flex: 1;
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgb(var(--color-muted, 100 116 139));
    text-transform: uppercase;
    letter-spacing: 0.025em;
    transition: color 0.3s, background-color 0.3s;
    white-space: nowrap;
    cursor: pointer;
}
.studio-sidebar-tab:hover {
    color: rgb(var(--color-text, 15 23 42));
}
.studio-sidebar-tab.active {
    font-weight: 700;
    color: rgb(var(--color-brand, 59 130 246));
    border-bottom: 2px solid rgb(var(--color-brand, 59 130 246));
}

.studio-sidebar-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    padding: 1rem;
    gap: 1.5rem;
    overflow-y: auto;
    padding-bottom: 3rem;
}
.studio-sidebar-panel.active {
    display: flex;
}

/* .studio-canvas (canvas container) */
.studio-canvas-area {
    flex: 1;
    background-color: rgba(var(--color-muted, 100 116 139), 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow: hidden;
    min-height: 50vh;
}
@media(min-width: 768px) {
    .studio-canvas-area {
        padding: 2rem;
        min-height: 0;
    }
}

.studio-canvas-wrapper {
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s;
    transform-origin: center;
}

.studio-canvas-controls {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 20;
}
@media(min-width: 768px) {
    .studio-canvas-controls {
        bottom: 1.5rem;
        right: 1.5rem;
    }
}

/* .studio-btn (button variants) */
.studio-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: var(--radius-pill, 9999px);
    transition: transform 0.3s, background-color 0.3s, color 0.3s;
    cursor: pointer;
    border: none;
}
.studio-btn:hover {
    transform: scale(1.05);
}
.studio-btn-primary {
    background-color: rgb(var(--color-brand, 59 130 246));
    color: #fff;
}
.studio-btn-outline {
    background-color: #fff;
    color: rgb(var(--color-text, 15 23 42));
    border: 1px solid rgb(var(--color-border, 226 232 240));
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.studio-btn-outline:hover {
    background-color: rgba(var(--color-surface, 248 250 252), 1);
}
.studio-btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-pill, 9999px);
    background-color: #fff;
    color: rgb(var(--color-muted, 100 116 139));
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}
.studio-btn-icon:hover {
    background-color: rgba(var(--color-surface, 248 250 252), 1);
    color: rgb(var(--color-text, 15 23 42));
}

.studio-btn-danger {
    color: #ef4444;
    border-color: #fee2e2;
}
.studio-btn-danger:hover {
    background-color: #fef2f2;
}

/* .studio-input (form inputs) */
.studio-input-group {
    position: relative;
    margin-bottom: 1rem;
}
.studio-input {
    width: 100%;
    padding: 0.5rem 1rem;
    background-color: rgb(var(--color-surface, 248 250 252));
    border: 1px solid rgb(var(--color-border, 226 232 240));
    border-radius: var(--radius-md, 0.5rem);
    font-size: 0.875rem;
    color: rgb(var(--color-text, 15 23 42));
    transition: all 0.3s;
    outline: none;
}
.studio-input:focus {
    border-color: rgb(var(--color-brand, 59 130 246));
    box-shadow: 0 0 0 2px rgba(var(--color-brand, 59 130 246), 0.2);
    background-color: rgb(var(--color-bg, 255 255 255));
}
.studio-input-search {
    padding-left: 2.25rem;
}
.studio-input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgb(var(--color-muted, 100 116 139));
    width: 1rem;
    height: 1rem;
}

.studio-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: rgb(var(--color-muted, 100 116 139));
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

/* .studio-palette (color/gradient pickers) */
.studio-palette-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}
.studio-color-swatch {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-pill, 9999px);
    border: 1px solid rgb(var(--color-border, 226 232 240));
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: transform 0.2s;
}
.studio-color-swatch:hover {
    transform: scale(1.1);
}
.studio-color-picker-wrapper {
    position: relative;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-pill, 9999px);
    overflow: hidden;
    border: 1px solid rgb(var(--color-border, 226 232 240));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}
.studio-color-picker-inner {
    width: 100%;
    height: 100%;
    background-color: #fff;
    border-radius: var(--radius-pill, 9999px);
}
.studio-color-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* .studio-font-picker (font selection) */
.studio-font-picker {
    width: 100%;
    font-size: 0.875rem;
    padding: 0.5rem;
    border: 1px solid rgb(var(--color-border, 226 232 240));
    border-radius: var(--radius-md, 0.5rem);
    background-color: rgb(var(--color-surface, 248 250 252));
    color: rgb(var(--color-text, 15 23 42));
    outline: none;
}

/* .studio-template-gallery (template grid) */
.studio-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}
.studio-gallery-item {
    cursor: pointer;
    border: 1px solid rgb(var(--color-border, 226 232 240));
    border-radius: var(--radius-md, 0.5rem);
    overflow: hidden;
    transition: border-color 0.3s;
}
.studio-gallery-item:hover {
    border-color: rgb(var(--color-brand, 59 130 246));
}
.studio-gallery-img {
    width: 100%;
    height: 5rem;
    object-fit: cover;
}

/* .studio-modal (export/save modals) */
.studio-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.studio-modal {
    background-color: rgb(var(--color-surface, 248 250 252));
    border-radius: var(--radius-lg, 1rem);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 1.5rem;
    width: 100%;
    max-width: 28rem;
    border: 1px solid rgb(var(--color-border, 226 232 240));
}

/* Utilities for Studio */
.studio-upload-box {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    background-color: rgb(var(--color-surface, 248 250 252));
    color: rgb(var(--color-brand, 59 130 246));
    border-radius: var(--radius-md, 0.5rem);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border: 1px dashed rgba(var(--color-brand, 59 130 246), 0.5);
    cursor: pointer;
    transition: background-color 0.3s;
}
.studio-upload-box:hover {
    background-color: rgba(var(--color-brand, 59 130 246), 0.05);
}

.studio-flex-row {
    display: flex;
    gap: 1rem;
}
.studio-flex-1 {
    flex: 1;
}

.studio-gradient-presets {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}
.studio-gradient-presets::-webkit-scrollbar {
    display: none;
}
.studio-gradient-preset-btn {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 9999px;
    flex-shrink: 0;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid #fff;
    cursor: pointer;
}

.studio-box {
    background-color: rgb(var(--color-surface, 248 250 252));
    padding: 0.75rem;
    border-radius: var(--radius-md, 0.5rem);
    border: 1px solid rgb(var(--color-border, 226 232 240));
}

.studio-badge {
    background-color: rgba(var(--color-brand, 59 130 246), 0.1);
    color: rgb(var(--color-brand, 59 130 246));
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0 0.5rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(var(--color-brand, 59 130 246), 0.2);
}
@media(min-width: 768px) {
    .studio-badge {
        font-size: 0.75rem;
    }
}

.studio-alignment-group {
    display: flex;
    gap: 0.5rem;
    background-color: rgb(var(--color-surface, 248 250 252));
    padding: 0.25rem;
    border-radius: var(--radius-md, 0.5rem);
    border: 1px solid rgb(var(--color-border, 226 232 240));
}
.studio-alignment-btn {
    flex: 1;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: background-color 0.3s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    background-color: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.studio-alignment-btn:hover {
    background-color: #fff;
}
.studio-alignment-btn svg {
    width: 1rem;
    height: 1rem;
    color: rgb(var(--color-muted, 100 116 139));
}
