/* ============================================
   BOTTLE CUSTOMIZER - PREMIUM DESIGN SYSTEM
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Core Colors */
    --accent: #6C5CE7;
    --accent-hover: #5A4BD1;
    --accent-soft: rgba(108, 92, 231, 0.12);
    --accent-glow: rgba(108, 92, 231, 0.3);

    /* Surfaces */
    --bg-app: #F0F0F5;
    --bg-panel: #FFFFFF;
    --bg-canvas-area: #E8E8EE;
    --bg-card: #F7F7FA;
    --bg-card-hover: #EEEEF4;
    --bg-input: #F4F4F8;

    /* Text */
    --text-primary: #1A1A2E;
    --text-secondary: #6B6B80;
    --text-muted: #9E9EB0;
    --text-on-accent: #FFFFFF;

    /* Borders */
    --border-light: rgba(0, 0, 0, 0.06);
    --border-medium: rgba(0, 0, 0, 0.1);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.1), 0 8px 20px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 20px var(--accent-glow);

    /* Layout */
    --header-height: 56px;
    --rail-width: 320px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 250ms;
    --duration-slow: 400ms;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   APP CONTAINER & LAYOUT
   ============================================ */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ============================================
   HEADER
   ============================================ */
.app-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-light);
    z-index: 100;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.app-logo {
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: var(--shadow-sm);
}

.app-title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    user-select: none;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--accent);
    color: var(--text-on-accent);
    box-shadow: var(--shadow-sm), 0 2px 8px var(--accent-glow);
}

.btn-primary:hover {
    box-shadow: var(--shadow-md), 0 4px 16px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-medium);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 18px;
}

.btn-icon:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn-danger {
    background: #FFF0F0;
    color: #E74C3C;
    border: 1px solid rgba(231, 76, 60, 0.15);
}

.btn-danger:hover {
    background: #FFE0E0;
}

/* ============================================
   USER AVATAR BUTTON
   ============================================ */
.user-avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    border: 2px solid var(--border-light);
    transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.user-avatar-btn:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-avatar-initials {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-on-accent);
    background: var(--accent);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* ============================================
   USER DROPDOWN MENU
   ============================================ */
.user-dropdown {
    position: fixed;
    top: calc(var(--header-height) + 4px);
    right: 16px;
    width: 280px;
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xl);
    z-index: 500;
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
    pointer-events: none;
    transition: all var(--duration-normal) var(--ease-out);
    padding: 8px;
    overflow: hidden;
}

.user-dropdown.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.dropdown-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.dropdown-avatar-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-light);
}

.dropdown-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.dropdown-user-name {
    font-size: 14px;
    font-weight: 700;
}

.dropdown-user-email {
    font-size: 11px;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 6px 4px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--duration-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: 'Inter', sans-serif;
}

.dropdown-item:hover {
    background: var(--bg-card);
}

.dropdown-item [data-lucide] {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.dropdown-item-primary {
    color: var(--accent);
    font-weight: 600;
}

.dropdown-item-primary:hover {
    background: var(--accent-soft);
}

.dropdown-item-danger {
    color: #E74C3C;
}

.dropdown-item-danger:hover {
    background: #FFF0F0;
}

.dropdown-guest-msg {
    padding: 20px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ============================================
   AUTH MODAL
   ============================================ */
.auth-modal-card {
    max-width: 400px;
}

.auth-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.auth-modal-icon {
    margin-bottom: 12px;
}

.auth-modal-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.auth-field {
    margin-bottom: 16px;
}

.auth-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.auth-error {
    color: #E74C3C;
    font-size: 12px;
    font-weight: 500;
    min-height: 20px;
    margin-bottom: 8px;
}

.auth-submit-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    margin-top: 4px;
}

.auth-switch {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 16px;
}

.auth-switch a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* ============================================
   PROFILE MODAL
   ============================================ */
.profile-pic-container {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.profile-modal-pic {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--border-light);
}

.profile-modal-pic-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-card);
    border: 3px dashed var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.profile-pic-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity var(--duration-fast);
}

.profile-pic-container:hover .profile-pic-overlay {
    opacity: 1;
}

/* ============================================
   MY DESIGNS GALLERY
   ============================================ */
.designs-gallery {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.design-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    transition: all var(--duration-fast);
    border: 2px solid transparent;
}

.design-card:hover {
    background: var(--bg-card-hover);
}

.design-card.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.design-thumb {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: var(--radius-sm);
    background: white;
    border: 1px solid var(--border-light);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.design-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.design-info {
    flex: 1;
    min-width: 0;
}

.design-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.design-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.design-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.design-actions .btn-icon {
    width: 30px;
    height: 30px;
}

.design-actions .btn-icon [data-lucide] {
    width: 14px;
    height: 14px;
}

/* ============================================
   APP BODY (Main Layout)
   ============================================ */
.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - var(--header-height));
}

/* ============================================
   LEFT RAIL / SIDEBAR
   ============================================ */
.left-rail {
    width: var(--rail-width);
    min-width: var(--rail-width);
    background: var(--bg-panel);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: transform var(--duration-slow) var(--ease-out);
}

.rail-header {
    padding: 14px 20px 10px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rail-close-btn {
    display: none;
}

.rail-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

/* Capsule Main Tabs */
.rail-tabs-capsule {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    padding: 3px;
    margin: 12px 16px 0;
    gap: 2px;
}

.rail-tab {
    flex: 1;
    padding: 8px 8px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    white-space: nowrap;
    text-align: center;
}

.rail-tab:hover {
    color: var(--text-primary);
}

.rail-tab.active {
    background: #FFFFFF;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Widgets View Styles */
.widget-box {
    background: #FFFFFF;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.widget-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.widget-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    background: var(--bg-input);
    color: var(--text-primary);
    margin-bottom: 12px;
    transition: border-color var(--duration-fast);
}

.widget-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

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

.widget-select {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    background: var(--bg-input);
    color: var(--text-primary);
    cursor: pointer;
}

.widget-color {
    width: 44px;
    height: 40px;
    padding: 2px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
}

.widget-format-group {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.format-btn {
    flex: 1;
    padding: 8px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.format-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.format-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
}
.format-btn:not(:last-child) {
    border-right: 1px solid var(--border-medium);
}

/* Sticker Grid */
.sticker-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.sticker-grid::-webkit-scrollbar {
    width: 4px;
}

.sticker-grid::-webkit-scrollbar-track {
    background: transparent;
}

.sticker-grid::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-full);
}

.sticker-item {
    aspect-ratio: 1;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: grab;
    transition: all var(--duration-normal) var(--ease-out);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.sticker-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-soft);
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-out);
}

.sticker-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-soft);
}

.sticker-item:hover::before {
    opacity: 1;
}

.sticker-item:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.sticker-item img,
.sticker-item i,
.sticker-item svg {
    position: relative;
    z-index: 1;
    pointer-events: none;
    transition: transform var(--duration-normal) var(--ease-spring);
}

.sticker-item img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

.sticker-item:hover img {
    transform: scale(1.1);
}

.sticker-item .sticker-name {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    position: relative;
    z-index: 1;
    line-height: 1.2;
}

/* ============================================
   CANVAS VIEWPORT
   ============================================ */
.canvas-viewport {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-canvas-area);
    padding: 30px;
    position: relative;
    overflow: hidden;
}

/* Background pattern */
.canvas-viewport::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(0,0,0,0.03) 1px, transparent 0);
    background-size: 24px 24px;
    pointer-events: none;
}

.canvas-wrapper {
    background: var(--bg-panel);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    position: relative;
    z-index: 1;
    transition: box-shadow var(--duration-normal) var(--ease-out);
}

.canvas-wrapper:hover {
    box-shadow: var(--shadow-xl), 0 0 0 1px var(--border-light);
}

.canvas-wrapper canvas {
    display: block;
}

/* ============================================
   RIGHT PANEL (Properties)
   ============================================ */
.right-panel {
    width: 280px;
    min-width: 280px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform var(--duration-slow) var(--ease-out);
}

.panel-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
}

.panel-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.prop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.prop-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.prop-input {
    width: 100px;
    padding: 6px 10px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color var(--duration-fast);
}

.prop-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Slider */
.slider-control {
    width: 100%;
}

.slider-control input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    outline: none;
}

.slider-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px var(--accent-glow);
    transition: transform var(--duration-fast) var(--ease-spring);
}

.slider-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 13px;
    line-height: 1.5;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--text-primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn var(--duration-slow) var(--ease-spring) forwards;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.toast-out {
    animation: toastOut var(--duration-normal) var(--ease-out) forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-10px) scale(0.95); }
}

/* ============================================
   CONTEXT MENU
   ============================================ */
.context-menu {
    position: fixed;
    background: var(--bg-panel);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 500;
    min-width: 180px;
    animation: menuIn var(--duration-fast) var(--ease-out);
}

@keyframes menuIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--duration-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.context-menu-item:hover {
    background: var(--bg-card);
}

.context-menu-item.danger {
    color: #E74C3C;
}

.context-menu-item.danger:hover {
    background: #FFF0F0;
}

.context-menu-divider {
    height: 1px;
    background: var(--border-light);
    margin: 4px 0;
}

/* ============================================
   TOOLBAR (Bottom floating on canvas)
   ============================================ */
.canvas-toolbar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    animation: toolbarIn var(--duration-slow) var(--ease-spring);
}

@keyframes toolbarIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toolbar-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) var(--ease-out);
}

.toolbar-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.toolbar-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-light);
    margin: 0 4px;
}

/* ============================================
   SNAP GUIDES
   ============================================ */
.snap-guide {
    position: absolute;
    background: #FF3B30;
    z-index: 1000;
    pointer-events: none;
    display: none;
    opacity: 0.8;
}

.snap-v { width: 1px; }
.snap-h { height: 1px; }

/* ============================================
   TEXT INPUT MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--duration-fast) var(--ease-out);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: var(--bg-panel);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 28px;
    width: 90%;
    max-width: 420px;
    animation: modalIn var(--duration-normal) var(--ease-spring);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

.modal-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color var(--duration-fast);
    margin-bottom: 12px;
}

.modal-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--bg-card);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   SKELETON LOADER
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: var(--radius-md);
}
@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-bottle { width: 100%; height: 180px; margin-bottom: 8px; }
.skeleton-text { width: 70%; height: 14px; margin: 4px auto; }

/* ============================================
   CANVAS BLEED LINES
   ============================================ */
.canvas-bleed-overlay {
    position: absolute;
    inset: 15px; /* Margen de seguridad (ej. 15px) */
    border: 2px dashed rgba(255, 59, 48, 0.5);
    pointer-events: none;
    z-index: 10;
    display: none;
    border-radius: 4px;
}
.canvas-bleed-overlay::after {
    content: 'MÁRGENES DE IMPRESIÓN';
    position: absolute;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 700;
    color: rgba(255, 59, 48, 0.8);
    white-space: nowrap;
}


/* ============================================
   MOBILE FAB (Floating Action Button)
   ============================================ */
.mobile-fab-group {
    display: none;
    position: absolute;
    bottom: 80px;
    right: 16px;
    z-index: 60;
}

.mobile-fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: white;
    box-shadow: var(--shadow-lg), 0 4px 16px var(--accent-glow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast);
}

.mobile-fab:active {
    transform: scale(0.9);
}

.fab-menu {
    position: absolute;
    bottom: 60px;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all var(--duration-spring) var(--ease-spring);
}

.mobile-fab-group.open .fab-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.mobile-fab-group.open #fab-main {
    transform: rotate(45deg);
}

.fab-item {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--bg-panel);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--duration-fast);
}

.fab-item:active {
    transform: scale(0.9);
    background: var(--bg-card);
}

/* ============================================
   MOBILE ACTIONS BOTTOM SHEET
   ============================================ */
.mobile-actions-overlay {
    align-items: flex-end;
}

.mobile-actions-sheet {
    width: 100%;
    max-width: 480px;
    background: var(--bg-panel);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 12px 20px 28px;
    animation: sheetUp var(--duration-normal) var(--ease-out);
}

@keyframes sheetUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.mobile-actions-handle {
    width: 36px;
    height: 4px;
    background: var(--border-medium);
    border-radius: var(--radius-full);
    margin: 0 auto 16px;
}

.mobile-actions-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
}

.mobile-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mobile-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.mobile-action-btn:active {
    transform: scale(0.96);
}

.mobile-action-btn [data-lucide] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.mobile-action-accent {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: transparent;
}

/* ============================================
   MOBILE BOTTOM SHEET
   ============================================ */
.mobile-toggle {
    display: none;
}

.header-desktop-btn {
    /* visible by default */
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .app-header {
        padding: 0 12px;
        height: 48px;
        --header-height: 48px;
    }

    .app-logo {
        width: 28px;
        height: 28px;
        min-width: 28px;
    }

    .app-title {
        font-size: 12px;
        max-width: 100px;
    }

    .header-actions {
        gap: 4px;
    }

    /* Hide desktop action buttons on mobile */
    .header-desktop-btn {
        display: none;
    }

    .left-rail {
        position: fixed;
        left: 0;
        top: var(--header-height);
        bottom: 0;
        transform: translateX(-100%);
        z-index: 90;
        box-shadow: var(--shadow-xl);
        width: 300px;
        min-width: 300px;
    }

    .left-rail.open {
        transform: translateX(0);
    }

    .rail-close-btn {
        display: flex;
    }

    /* Properties → Bottom Sheet on mobile */
    .right-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        min-width: 100%;
        max-height: 45vh;
        transform: translateY(100%);
        z-index: 95;
        box-shadow: 0 -8px 30px rgba(0,0,0,0.12);
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        border-left: none;
        border-top: 1px solid var(--border-light);
    }

    .right-panel.open {
        transform: translateY(0);
    }

    .right-panel .rail-header {
        padding: 10px 20px 8px;
        position: relative;
    }

    .right-panel .rail-header::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: var(--border-medium);
        border-radius: var(--radius-full);
    }

    .right-panel .panel-section {
        padding: 12px 20px;
    }

    .right-panel .panel-section-title {
        margin-bottom: 8px;
    }

    .mobile-toggle {
        display: flex;
    }

    .mobile-fab-group {
        display: flex;
    }

    .canvas-viewport {
        padding: 16px;
    }

    .canvas-toolbar {
        bottom: 12px;
        padding: 4px 6px;
        gap: 2px;
    }

    .toolbar-btn {
        width: 32px;
        height: 32px;
    }

    .toolbar-divider {
        height: 18px;
    }

    .user-avatar-btn {
        width: 32px;
        height: 32px;
    }

    .user-dropdown {
        right: 8px;
        width: calc(100vw - 16px);
        max-width: 320px;
    }

    .app-body {
        height: calc(100vh - 48px);
    }
}

@media (max-width: 400px) {
    .app-title {
        display: none;
    }

    .rail-tabs-capsule {
        margin: 8px 12px 0;
    }

    .rail-tab {
        font-size: 11px;
        padding: 7px 6px;
    }
}

/* ============================================
   ICONS
   ============================================ */
[data-lucide] {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}
.btn [data-lucide],
.toolbar-btn [data-lucide],
.context-menu-item [data-lucide] {
    width: 18px;
    height: 18px;
}

/* ============================================
   MOBILE PROPERTIES HINT
   ============================================ */
.mobile-props-hint {
    display: none;
}

@media (max-width: 900px) {
    .mobile-props-hint {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        bottom: 70px;
        left: 12px;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: var(--accent);
        color: white;
        border: none;
        box-shadow: 0 4px 16px var(--accent-glow), var(--shadow-md);
        cursor: pointer;
        z-index: 20;
        animation: propsHintPulse 0.4s var(--ease-spring);
    }

    .mobile-props-hint [data-lucide] {
        width: 20px;
        height: 20px;
    }

    @keyframes propsHintPulse {
        from { transform: scale(0.5); opacity: 0; }
        to { transform: scale(1); opacity: 1; }
    }
}
