/* ==========================================================================
   Garmin Designer - Watch Face Studio (Apple Cupertino Pro Studio)
   ========================================================================== */

.editor-body {
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #F5F5F7;
}

/* Studio Header - Translucent Apple Bar */
.studio-header {
    height: 60px;
    background: var(--bg-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 50;
    flex-shrink: 0;
}

.studio-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
}

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

.model-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.model-name-badge {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.model-res-tag {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    background: var(--bg-secondary);
    color: var(--accent-blue);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

/* Studio Header Center (Segmented Controls) */
.studio-header-center {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-group {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 3px;
}

.tool-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.tool-btn:hover:not(:disabled) {
    color: var(--text-primary);
    background: var(--bg-surface);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.tool-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.tool-btn.active {
    background: var(--bg-surface);
    color: var(--accent-blue);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Studio Header Right (Eksport & Akcje) */
.studio-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ==========================================================================
   Główny Layout 3-Panelowy (macOS Pro App Style)
   ========================================================================== */
.studio-main {
    flex: 1;
    display: grid;
    grid-template-columns: 310px 1fr 330px;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* --- LEWY PANEL: BIBLIOTEKA ELEMENTÓW --- */
.left-panel {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-tabs {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    padding: 8px 10px;
    gap: 6px;
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 0;
}

.panel-tabs::-webkit-scrollbar {
    display: none;
}

.panel-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 7px 14px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    text-align: center;
}

.panel-tab:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
}

.panel-tab.active {
    color: var(--text-primary);
    background: var(--bg-surface);
    border-color: var(--border-subtle);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-label {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.elements-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.element-add-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
}

.element-add-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-blue);
    background: var(--bg-surface);
    box-shadow: var(--shadow-card);
}

.element-add-icon {
    font-size: 1.5rem;
}

.element-add-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Szablony w lewym panelu */
.templates-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.template-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.template-card:hover {
    border-color: var(--accent-blue);
    background: var(--bg-surface);
    transform: translateX(4px);
    box-shadow: var(--shadow-subtle);
}

.template-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.template-card-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

/* --- ŚRODKOWY OBSZAR: STUDIO STAGE --- */
.center-studio {
    background: #EBEBEF;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-image: 
        radial-gradient(circle at center, rgba(255, 255, 255, 0.9) 0%, rgba(235, 235, 239, 0.4) 70%),
        linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 24px 24px, 24px 24px;
}

.canvas-viewport {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: calc(100vh - 170px);
    margin-bottom: 30px;
}

/* Realistyczna Obudowa Zegarka (Titanium Case) */
.watch-case {
    position: relative;
    padding: 20px;
    background: linear-gradient(145deg, #475263 0%, #1e2430 50%, #2f3847 100%);
    border-radius: 50%;
    box-shadow: 
        0 24px 60px rgba(0, 0, 0, 0.25),
        0 8px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 2px rgba(255, 255, 255, 0.35),
        inset 0 -2px 6px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.watch-case.rect {
    border-radius: 44px;
    padding: 18px;
}

/* Polerowane śrubki na bezelu Fenix */
.watch-case.fenix-rugged::before,
.watch-case.fenix-rugged-solar::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9aa7bc;
    box-shadow: 
        0 0 0 1px #222,
        0 calc(100% + 400px) 0 0 #9aa7bc;
}

/* Solar Bezel - bursztynowy pierścień ładowania słonecznego */
.watch-case.fenix-rugged-solar {
    background: linear-gradient(145deg, #3d3b36 0%, #1e1d1a 50%, #2f2c25 100%);
    border: 2px solid rgba(255, 170, 0, 0.25);
    box-shadow: 
        0 24px 60px rgba(0, 0, 0, 0.35),
        0 0 20px rgba(255, 170, 0, 0.08),
        inset 0 0 12px rgba(255, 170, 0, 0.15);
}

/* Forerunner - lekki sportowy polimerowy bezel */
.watch-case.forerunner-sport {
    background: linear-gradient(145deg, #2c3340 0%, #141820 100%);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.2);
}

/* Venu & Vivoactive - elegancka stalowa polerowana ramka */
.watch-case.venu-elegant {
    background: linear-gradient(145deg, #6c788a 0%, #303742 50%, #4f5a6b 100%);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25), inset 0 2px 4px rgba(255, 255, 255, 0.5);
}

/* Tactix - taktyczny czarny mat z nacięciami */
.watch-case.tactix-stealth {
    background: linear-gradient(145deg, #22252a 0%, #111317 100%);
    border: 1px solid #333842;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

/* MARQ - luksusowy szczotkowany tytan klasy 5 */
.watch-case.marq-luxury {
    background: linear-gradient(145deg, #717d8e 0%, #3a424e 50%, #576272 100%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

/* Instinct - pancerna obudowa z tworzywa zbrojonego włóknem szklanym */
.watch-case.instinct-rugged {
    background: linear-gradient(145deg, #333b47 0%, #1a1e24 100%);
    border: 3px solid #282e38;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.watch-canvas {
    display: block;
    cursor: crosshair;
    border-radius: 50%;
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.85);
    max-width: min(400px, 52vh);
    max-height: min(400px, 52vh);
    width: auto;
    height: auto;
}

.watch-case.rect .watch-canvas {
    border-radius: 24px;
}

/* Pasek symulacji parametrów na dole (Floating Glass Pill) */
.simulation-bar {
    position: absolute;
    bottom: 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 8px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    box-shadow: var(--shadow-card);
    z-index: 10;
}

.sim-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.sim-slider {
    width: 100px;
    accent-color: var(--accent-blue);
    cursor: pointer;
}

/* --- PRAWY PANEL: INSPEKTOR WŁAŚCIWOŚCI & WARSTWY --- */
.right-panel {
    background: var(--bg-surface);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.inspector-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.inspector-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.inspector-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

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

.property-label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.prop-input {
    width: 100%;
    padding: 9px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.88rem;
    outline: none;
    transition: all var(--transition-fast);
}

.prop-input:focus {
    border-color: var(--accent-blue);
    background: var(--bg-surface);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.color-input {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
}

/* Lista Warstw (Layers) */
.layers-container {
    border-top: 1px solid var(--border-subtle);
    padding: 18px 20px;
}

.layers-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.layer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.layer-item:hover {
    background: var(--bg-tertiary);
}

.layer-item.active {
    border-color: var(--accent-blue);
    background: rgba(0, 113, 227, 0.08);
    color: var(--accent-blue);
    font-weight: 600;
}

.layer-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.layer-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
}

.layer-btn:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.06);
}

/* Modale & Poradniki */
.install-steps {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 20px 0;
}

.install-step-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.step-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: #FFFFFF;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.82rem;
    flex-shrink: 0;
}

/* ==========================================================================
   Pasek Dolnej Nawigacji Mobilnej (Mobile Bottom Bar)
   ========================================================================== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 64px;
    background: var(--bg-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--border-subtle);
    z-index: 100;
    padding: 0 12px;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    padding: 6px 0;
    transition: all var(--transition-fast);
}

.mobile-nav-btn.active {
    color: var(--accent-blue);
}

.mobile-nav-icon {
    font-size: 1.25rem;
}

/* ==========================================================================
   Responsywność Studia dla Tabletów i Telefonów
   ========================================================================== */
@media (max-width: 1024px) {
    .editor-body {
        height: 100%;
        min-height: 100vh;
        overflow-y: auto;
    }

    .studio-header {
        height: auto;
        padding: 10px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .studio-header-left {
        gap: 8px;
    }

    .model-name-badge {
        font-size: 0.95rem;
    }

    .model-res-tag {
        display: none;
    }

    .studio-header-center {
        order: 3;
        width: 100%;
        justify-content: center;
        padding: 4px 0;
    }

    .studio-header-right {
        gap: 6px;
    }

    .studio-header-right .btn {
        padding: 6px 12px;
        font-size: 0.78rem;
    }

    /* Przełączanie widoków na telefonie */
    .mobile-bottom-nav {
        display: flex;
    }

    .studio-main {
        display: block;
        height: auto;
        min-height: calc(100vh - 120px);
        margin-bottom: 70px;
    }

    /* Domyślnie na mobile pokazujemy tylko aktywny widok */
    .studio-main[data-mobile-view="left"] .left-panel {
        display: flex !important;
        width: 100%;
        height: calc(100vh - 170px);
    }
    .studio-main[data-mobile-view="left"] .center-studio,
    .studio-main[data-mobile-view="left"] .right-panel {
        display: none !important;
    }

    .studio-main[data-mobile-view="center"] .center-studio {
        display: flex !important;
        width: 100%;
        min-height: calc(100vh - 170px);
        padding: 20px 10px;
    }
    .studio-main[data-mobile-view="center"] .left-panel,
    .studio-main[data-mobile-view="center"] .right-panel {
        display: none !important;
    }

    .studio-main[data-mobile-view="right"] .right-panel {
        display: flex !important;
        width: 100%;
        height: calc(100vh - 170px);
    }
    .studio-main[data-mobile-view="right"] .left-panel,
    .studio-main[data-mobile-view="right"] .center-studio {
        display: none !important;
    }

    .left-panel, .right-panel {
        border: none;
    }

    .canvas-viewport {
        max-height: 48vh;
        margin-bottom: 70px;
    }

    .watch-canvas {
        max-width: min(290px, 42vh);
        max-height: min(290px, 42vh);
    }

    .watch-case {
        padding: 14px;
    }

    .simulation-bar {
        bottom: 12px;
        padding: 6px 14px;
        gap: 12px;
        flex-wrap: wrap;
        justify-content: center;
        width: 92%;
    }

    .sim-slider {
        width: 70px;
    }
}
