body {
    margin: 0;
}

/* 🆕 3D modeļa priekšskatījums (labā puse) paliek redzams, ritinot uz leju
   garā sides sarakstā (kreisā puse) — lai admin var redzēt izmaiņas
   uzreiz, arī ja atvērti vairāki side/Transform paneļi vienlaicīgi.
   css/style.css .sides_3dmodel noklusējuma align-items (stretch) stiepj
   .sides_3d_model_preview uz visa rindas augstumu, kas neļautu tam
   "pielipt" — tāpēc flex-start, lai tas paliek sava satura augstumā.
   top:70px = fiksētā admin header augstums (54px, sk. .header-wrap) +
   neliela atkāpe. */
.sides_3dmodel {
    align-items: flex-start;
}
.sides_3d_model_preview {
    position: sticky;
    top: 70px;
    align-self: flex-start;
}

.sides_3d_model_sides_list{
    display: flex;
    width:100%;
    max-width:980px;
}
.sides_3dmodel{
    max-width:980px;
    margin:0 auto;
    gap:0;
    width:100%;
}
.sides_3dmodel .sides_3d_model_items{
    flex-direction: column;
    gap:0;
    width:100%;
    max-width:640px;
}

.flex-container {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

canvas.threejs-canvas {
    display: block;
    width: 500px;
    height: 500px;
}

.threejs-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width:100%;
}

.control-group {
    margin-bottom: 20px;
    width:100%;
}

.custom-button,
.custom-input,
.custom-canvas {
    display: block;
    margin: 5px 0;
}

.custom-button,
.custom-label {
    width: auto;
    height: auto;
    font-size: 14px;
    padding: 5px;
    font-weight: bold;
    border: none;
    background-color: #9A2F58;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    margin: 5px;
    text-align: center;
}

.custom-button:hover,
.custom-label:hover {
    background-color: #7e2445;
}

.custom-input[type="file"] {
    display: none;
}

.control-row {
    display: flex;
    align-items: center;
    padding: 10px 10px 0 0;
    padding: 0;
    margin: 0px;
    width:100%;
    flex-direction: column;
}

.control-row canvas {
    margin-right: 20px;
    max-width: 150px;
    height: auto;
    display: none;
    /* Maintain aspect ratio */
}

.control-buttons,
#model-controls {
    display: flex;
    flex-direction: row;
    margin: 0px;
    padding: 5px;
    list-style-type: none;
    width:100%;
    /* Remove bullets */

}
.control-buttons{
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap:10px;
    display: flex;
    flex-direction: column;
}
.control-buttons-row {
    display: flex;
    margin-bottom: 10px;
}

.model-controls-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    /*flex: 0 0 300px;*/
}

.model-controls-list>li {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: 1px solid #9A2F58;
    border-radius: 5px;
    background-color: #fff;
    color: #000;
    cursor: pointer;
}

.model-controls-list>li:hover {
    background-color: #f0f0f0;
}

.model-controls-list ul {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-top: 5px;
    padding: 0;
    list-style-type: none;
    /* Remove bullets */
}

.downloadModel {
    width: 150px;
    height: 50px;
    font-size: 24px;
    background-color: #e91e63;
    align-self: center;
    margin-top: 20px;
}

.downloadModel:hover {
    background-color: #c2185b;
}

#model-controls {
    /*flex-direction: row;*/
}

.sides_3d_model_canvas_container {
    flex-direction: column;
}

.centered-color-picker {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    z-index: 1000;
}


/*ui slider x y z */
.slider-container {
    margin: 5px 5px;
    padding: 5px;
    background: #f8f9fa;
    border-radius: 0px;
    font-size: 12px;
}

.slider-container.scale-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.slider-label {
    display: block;
    margin-bottom: 0px;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.scale-container .slider-label {
    color: white;
}

.slider-value {
    color: #9A2F58;
    margin-left: 5px;
    font-family: 'Courier New', monospace;
}

.scale-container .slider-value {
    color: #ffd700;
}

.slider-input {
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.slider-input:focus {
    outline: none;
    border-color: #9A2F58;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

.scale-container .slider-input {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
}

.scale-container .slider-input:focus {
    border-color: #ffd700;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

/* jQuery UI Slider customizacija */
/*.control-buttons .ui-slider {
    height: 10px;
    background: #ddd;
    border-radius: 5px;
    border: none;
    margin: 10px 0;
}

.control-buttons .scale-container .ui-slider {
    background: rgba(255, 255, 255, 0.3);
}

.control-buttons .ui-slider-handle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    top: -10px;
    transition: all 0.2s ease;
}

.control-buttons .ui-slider-handle:hover {
    background: #0056b3;
    transform: scale(1.15);
}

.control-buttons .control-buttons .scale-container .ui-slider-handle {
    background: #ffd700;
}

.control-buttons .scale-container .ui-slider-handle:hover {
    background: #ffed4e;
}

.control-buttons .ui-slider-handle:focus {
    outline: none;
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.5);
}*/


/* Select Container */
.select-container {
    margin: 0px 0;
    padding: 0px;
    width:100%;
    position:relative;
    box-sizing:border-box;
}

.part-select {
    width: 100%;
    background-color: #fff;
    border-radius: 3px;
    border: 1px solid #C3CBD5;
    box-shadow: none;
    height: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    padding-right: 40px;
    padding: 0 0 0 8px;
    background-image: none;
}

.select-container:after {
    content: "";
    position: absolute;
    top: 18px;
    right: 80px;
    width: 2px;
    height: 2px;
    border: solid rgba(30, 46, 87, 0.8);
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 3px;
    transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    background: none;
}

.part-select:hover {
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.part-select:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.3);
}

/* Options Container */
.options-container {
    margin: 0px 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
    width: 100%;
}

.options-container.hidden {
    display: none;
    opacity: 0;
    transform: translateY(-20px);
}

.options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    color: white;
}

.options-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

.header-icon {
    font-size: 24px;
}

.close-options-btn {
    background: rgba(0, 0, 0, 0);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-options-btn:hover {
    background: rgba(0, 0, 0, 0.3);
    transform: rotate(90deg);
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 5px;
    font-size: 12px;
}

/* Option Card */
.option-card {
    /*background: #f8f9fa;
    border-radius: 10px;
    padding: 5px;
    transition: all 0.3s ease;*/
}
/*
.option-card-full {
    grid-column: 1 / -1;
}*/

/*.option-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.option-title {
    font-weight: 600;
    color: #333;
    font-size: 15px;
    flex: 1;
}*/

.option-value {
    display: flex;
    position: relative;
    border-radius: 3px;
    max-width: 150px;
    padding: 1px 10px;
    border: 1px solid #C3CBD5;
    font-size: 12px;
}

.option-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.option-body.checkbox{
    flex-direction: row;
    align-items: center;
}
/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 30px;
}

.slider-toggle:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider-toggle {
    background-color: #4CAF50;
}

input:checked + .slider-toggle:before {
    transform: translateX(30px);
}

.toggle-label {
    margin-left: 10px;
    font-weight: 600;
    color: #666;
}

/* Color Picker */
.color-picker-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.color-picker-group input[type="color"] {
    width: 30px;
    height: 30px;
    border: 3px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-picker-group input[type="color"]:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.color-hex {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #667eea;
    font-size: 16px;
}

/* Slider */
/*.slider-wrapper {
    margin: 10px 0;
}

.slider-wrapper .ui-slider {
    height: 10px;
    background: #ddd;
    border-radius: 5px;
    border: none;
}

.slider-wrapper .ui-slider-handle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #667eea;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    top: -8px;
    transition: all 0.2s ease;
}

.slider-wrapper .ui-slider-handle:hover {
    background: #764ba2;
    transform: scale(1.15);
}*/

.slider-input {
    width: 100%;
    padding: 5px;
    border: 2px solid #ddd;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
}

.slider-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Responsive */
@media (max-width: 768px) {
    .options-grid {
        grid-template-columns: 1fr;
    }

    .option-card-full {
        grid-column: 1;
    }
}

/* Animation Controls Container */
.animation-controls-container {
    margin: 20px 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.animation-header {
    padding: 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.animation-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

/* Animation Selector */
.animation-selector {
    padding: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.animation-select {
    width: 100%;
    padding: 12px 15px;
    font-size: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.animation-select:hover {
    border-color: #f5576c;
}

.animation-select:focus {
    outline: none;
    border-color: #f093fb;
    box-shadow: 0 0 0 3px rgba(240, 147, 251, 0.2);
}

/* Playback Controls */
.playback-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.control-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
}

.control-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.5);
}

.control-btn:active {
    transform: scale(0.95);
}

/* Speed Control */
.speed-control {
    padding: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.speed-control label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

#speed-value {
    color: #f5576c;
    font-family: 'Courier New', monospace;
}

#speed-slider {
    margin: 10px 0;
}

#speed-slider .ui-slider {
    height: 8px;
    background: #ddd;
    border-radius: 4px;
}

#speed-slider .ui-slider-handle {
    width: 20px;
    height: 20px;
    background: #f5576c;
    border: 3px solid white;
    border-radius: 50%;
    top: -6px;
    cursor: pointer;
}

/* Loop Control */
.loop-control {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.loop-label {
    font-weight: 600;
    color: #333;
}

/* Animation Info */
.animation-info {
    padding: 20px;
    background: #f8f9fa;
}

.animation-info p {
    margin: 8px 0;
    color: #666;
}

.animation-info strong {
    color: #333;
}






/* 🆕 Materials editor (action=edit_3d_model_materials) — VIENS globāls
   panelis (Camera/Intensity/Opacity/Ambient/Emissive), sk. admin.js
   buildGlobalMaterialsPanel(). Klases scope'otas zem .materials-editor-panel,
   lai neietekmētu .option-card/.layer-heading citur (piem. "Pick" plūsmā
   Matching Sides ekrānā). */
.materials-editor-panel {
    border: 1px solid #C3CBD5;
    border-radius: 6px;
    background: #fff;
    width: 100%;
    max-width: 480px;
    overflow: hidden;
}
.materials-editor-panel .layer-option-section {
    border-top: 1px solid #E7EAEE;
}
.materials-editor-panel .layer-option-section:first-child {
    border-top: none;
}
.materials-editor-panel .layer-heading {
    font-weight: 600;
}
/* Bāzes site-wide reset (css/style.css: "textarea, input{appearance:none}")
   noņem checkbox noklusēto izmēru — atjaunojam to tikai šeit, jo šie ir
   vienkārši, nesaistīti (disabled) placeholderi bez pielāgota .checkmark. */
.materials-editor-panel input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border: 1px solid #C3CBD5;
    border-radius: 3px;
    background: #fff;
    position: relative;
    flex: 0 0 16px;
}
.materials-editor-panel input[type="checkbox"]:checked {
    background: #9A2F58;
    border-color: #9A2F58;
}
.materials-editor-panel input[type="checkbox"]:checked:after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.materials-editor-heading-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 🆕 Vispārīgs "vai šis ir atvērts/aizvērts" chevron — lieto gan Materials
   editor (Camera/Intensity/Opacity/Ambient/Emissive rindas, kur "collapsed"
   ir uz PAŠU rindu), gan Matching Sides ekrāna "T_Shirt_..."/Transform
   galvenēm (kur "collapsed" ir uz VECĀKA .layer-options konteineru) — sk.
   admin.js showPartOptions()/createControls(). Aizstāj iepriekšējo statisko
   "X" pogu, lai lietotājs redz PAŠREIZĒJO atvērts/aizvērts stāvokli.
   Nav scope'ots zem .materials-editor-panel, jo tagad lieto abās vietās. */
.admin-chevron {
    position: relative;
    width: 10px;
    height: 10px;
    flex: 0 0 10px;
}
.admin-chevron:after {
    content: "";
    position: absolute;
    top: 2px;
    left: 1px;
    width: 6px;
    height: 6px;
    border: solid #15191E;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}
/* Materials editor: "collapsed" ir uz .layer-option-section (rindas) pašas */
.layer-option-section:not(.collapsed) > .layer-heading .admin-chevron:after {
    transform: rotate(-135deg);
    top: 5px;
}
/* Matching Sides: "collapsed" ir uz .layer-options (konteinera) paša */
.layer-options:not(.collapsed) > .add-design .admin-chevron:after {
    transform: rotate(-135deg);
    top: 5px;
}

/* 🆕 "Tavs dizains"/"Aizmugure" rindas (sides list, action=3dmodel) — noņemt
   pelēko kartes rāmi (css/tabs.css .layer-options{border...}), lai
   atbilstu Figma "Sides list" plakanajam sarakstam. Scope'ots ar
   .layer-options-text (kas ir TIKAI šai per-side wrapper klasei, sk.
   templates/3d/admin/design_3dmodel_sides_item.htm.inc), lai neietekmētu
   Transform/materiālu paneļus (tiem ir tikai .layer-options, bez
   "-text" piedēkļa) — tiem rāmis paliek vajadzīgs. */
.layer-options-text {
    border: none;
    border-radius: 0;
    background: transparent;
    margin-top: 0;
    border-bottom: 1px solid #E7EAEE;
}
.layer-side:last-child .layer-options-text {
    border-bottom: none;
}

/* ?? Mesh Pick poga */
.btn-pick-mesh {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px !important;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #f5f5f5;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-pick-mesh:hover {
    background: #e0e0e0;
    border-color: #999;
}

.btn-pick-mesh.active {
    background-color: #ff6b35 !important;
    color: #fff !important;
    border-color: #e55a24;
    animation: pulse-pick 1s infinite;
}

@keyframes pulse-pick {
    0%   { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.5); }
    70%  { box-shadow: 0 0 0 6px rgba(255, 107, 53, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0); }
}