
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /*background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);*/
    min-height: 100vh;
    padding: 20px;
}

.container {
    /*max-width: 1600px;*/
    margin: 0 auto;
}
.container {
    display: grid;
    grid-template-columns: [side-start] 300px [side-end] 20px [content-start] 1fr [content-end];
    grid-template-rows: [header-start] auto [header-end] 20px [content-start] 1fr [content-end];
}
aside {
    grid-column: side-start / side-end;
    grid-row: content-start / content-end;
}
main {
    grid-column: content-start / content-end;
    grid-row: header-start / content-end;
}

.header {
    text-align: center;
    color: #c60e0e;
    margin-bottom: 40px;
    grid-column: side-start / side-end;
    grid-row: header-start / header-end;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.controls {
    /*background: white;*/
    
}

.upload-section {
    margin-bottom: 25px;
}

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

.file-input {
    display: block;
    width: 100%;
    padding: 12px;
    border: 2px dashed #667eea;
    border-radius: 8px;
    cursor: pointer;
    background: #f8f9ff;
    transition: all 0.3s;
}

.file-input:hover {
    border-color: #764ba2;
    background: #f0f1ff;
}

.control-section {
    margin-bottom: 25px;
}

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

.option-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.option-btn {
    padding: 10px 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    background: white;
    font-weight: 500;
    transition: all 0.3s;
}

.option-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.option-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}
.option-btn.remove {
    position: absolute; top: 0; right: 0;
}

.placement-section {
    margin-bottom: 25px;
}

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

.placement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
}

.placement-checkbox {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.placement-checkbox:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.placement-checkbox.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
    position: sticky;
    top: 0;
}

.placement-checkbox input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.shirts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
}

.shirt-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.shirt-name {
    text-align: center;
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #333;
}

.shirt-views {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.shirt-view {

}

.view-label {
    text-align: center;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.shirt-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 0.85;
    border-radius: 10px;
    overflow: hidden;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.logo-container {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    z-index: 1; /* baseline to ensure predictable stacking */
    overflow: hidden; /* keep logo graphic inside the container's max bounds */
}

.logo-container.front-top {
    top: 32%;
    left: 50%;
    transform: translateX(-50%);
    width: 35%;
    aspect-ratio: 2 / 1;
}

.logo-container.front-bottom {
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    width: 35%;
    aspect-ratio: 2 / 1;
}

.logo-container.back-top {
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    width: 35%;
    aspect-ratio: 2 / 1;
}

.logo-container.back-bottom {
    bottom: 30%;
    left: 50%;
    transform: translateX(-50%);
    width: 35%;
    aspect-ratio: 2 / 1;
}

.logo-container.left-shoulder {
    top: 25%;
    left: 52%;
    transform: translateX(-50%);
    width: 25%;
    aspect-ratio: 2 / 1;
}

.logo-container.right-shoulder {
    top: 25%;
    left: 47%;
    transform: translateX(-50%);
    width: 25%;
    aspect-ratio: 2 / 1;
}

.logo-placement {
    width: 100px;
    height: 60px;
    object-fit: contain;
    transition: filter 0.3s;
}

/* New: mask-based colorized logo to support any color */
.logo-mask {
    width: 100%;
    height: 100%;
    /* Center the masked logo and keep aspect */
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    /* Fallback smooth transition when color changes */
    transition: background-color 0.25s ease;
}

.filter-black { filter: none; }
.filter-white { filter: brightness(0) invert(1); }
.filter-red { filter: brightness(0.5) sepia(1) hue-rotate(-50deg) saturate(5); }
.filter-blue { filter: brightness(0.5) sepia(1) hue-rotate(180deg) saturate(3); }
.filter-green { filter: brightness(0.5) sepia(1) hue-rotate(60deg) saturate(4); }

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    width: 80%;
}

.empty-state svg {
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
    opacity: 0.5;
}
#redshirt .shirt-preview {

}

/* Nudge controls */
.nudge-controls {
  position: absolute;
  bottom: -10px;
  right: -10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: rgba(0,0,0,0.4);
  padding: 4px;
  border-radius: 6px;
}

.nudge-row { display: flex; gap: 2px; }

.nudge-btn {
  border: none;
  background: rgba(255,255,255,0.9);
  color: #333;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}

.nudge-btn:hover { background: white; }

/* Ensure the controls are visible above the masked logo */
.logo-container { position: absolute; }
.logo-container .nudge-controls { z-index: 2; }
.logo-container .logo-mask { z-index: 1; }

/* Active editing: raise and outline */
.logo-container.active-edit {
  z-index: 10; /* ensure it stays on top of other placements */
  outline: 2px dashed rgba(255,255,255,0.8);
  outline-offset: 2px;
  /* also highlight inside the bounds so it remains visible with overflow-hidden parents */
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.85);
}


.password-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.password-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 400px;
}

.password-form h2 {
    margin-bottom: 1.5rem;
    color: #333;
    text-align: center;
}

.password-form input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: border-color 0.3s;
}

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

.password-form button {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.password-form button:hover {
    transform: translateY(-2px);
}

.password-form button:active {
    transform: translateY(0);
}

.error-message {
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    text-align: center;
}

.hint {
    background: #f0f0f0;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #666;
    text-align: center;
}