/* ============================================
   NAIL BATCH EDITOR — STYLESHEET v2
   Google Font: Inter
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background: #f0f2f5;
    margin: 0; padding: 0;
    overflow-x: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: 280px; height: 100vh;
    background: #18181b;
    display: flex; flex-direction: column;
    z-index: 100;
    overflow: hidden;
}

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.sidebar-header .app-name {
    font-size: 18px; font-weight: 800;
    color: #fff; letter-spacing: -0.3px;
    display: flex; align-items: center; gap: 8px;
}

.sidebar-header .app-sub {
    font-size: 11px; color: #71717a;
    margin-top: 3px; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.8px;
}

.sidebar-body {
    flex: 1; overflow-y: auto;
    padding: 16px 16px 8px;
    scrollbar-width: thin;
    scrollbar-color: #3f3f46 transparent;
}
.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-thumb { background: #3f3f46; border-radius: 4px; }

.sidebar-footer {
    padding: 12px 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

/* ============================================
   STEP CARDS
   ============================================ */
.step-card {
    background: #27272a;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(255,255,255,0.06);
    transition: border-color 0.2s;
}
.step-card:hover { border-color: rgba(255,255,255,0.12); }

.step-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px;
}
.step-badge {
    width: 20px; height: 20px; border-radius: 50%;
    background: #3f3f46;
    font-size: 10px; font-weight: 700; color: #a1a1aa;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.step-card.active .step-badge {
    background: #f4a261; color: #18181b;
}
.step-title {
    font-size: 12px; font-weight: 600;
    color: #d4d4d8;
    text-transform: uppercase; letter-spacing: 0.5px;
}

/* ============================================
   INPUTS
   ============================================ */
.upload-zone {
    width: 100%;
    background: rgba(255,255,255,0.03);
    border: 1.5px dashed #3f3f46;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    color: #71717a;
    font-size: 12px;
    text-align: center;
    transition: all 0.2s;
    display: block;
    position: relative;
    overflow: hidden;
}
.upload-zone:hover {
    border-color: #f4a261;
    color: #f4a261;
    background: rgba(244,162,97,0.05);
}
.upload-zone input[type="file"] {
    position: absolute; inset: 0;
    opacity: 0; cursor: pointer;
    width: 100%; height: 100%;
}
.upload-icon { font-size: 18px; display: block; margin-bottom: 4px; }
.upload-label { font-weight: 500; }
.upload-hint { font-size: 10px; color: #52525b; margin-top: 2px; }

/* Ratio Pills */
.ratio-pills {
    display: flex; gap: 8px;
}
.ratio-pill {
    flex: 1; padding: 6px 4px;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid #3f3f46;
    border-radius: 8px;
    text-align: center; cursor: pointer;
    transition: all 0.2s;
    color: #a1a1aa; font-size: 11px; font-weight: 600;
}
.ratio-pill:hover { border-color: #71717a; color: #d4d4d8; }
.ratio-pill.active {
    border-color: #f4a261;
    background: rgba(244,162,97,0.12);
    color: #f4a261;
}
.ratio-pill .ratio-icon {
    display: block; margin: 0 auto 4px;
    background: currentColor;
    border-radius: 2px;
}
.ratio-pill .ratio-text { font-size: 10px; }

/* Color Palette Swatches */
.color-swatch {
    width: 14px; height: 14px; border-radius: 50%;
    cursor: pointer; border: 1.5px solid rgba(255,255,255,0.2);
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
    transition: transform 0.2s, border-color 0.2s;
}
.color-swatch:hover { transform: scale(1.15); border-color: #fff; }
.color-swatch.active { border-color: #f4a261; transform: scale(1.15); box-shadow: 0 0 4px #f4a261; }

/* Text input */
.text-input {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid #3f3f46;
    border-radius: 8px;
    padding: 9px 12px;
    color: #e4e4e7;
    font-size: 13px; font-weight: 500;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    outline: none;
}
.text-input:focus {
    border-color: #f4a261;
    background: rgba(244,162,97,0.05);
}
.text-input::placeholder { color: #52525b; }

/* Select */
.styled-select {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1.5px solid #3f3f46;
    border-radius: 8px;
    padding: 9px 12px;
    color: #e4e4e7;
    font-size: 12px; font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
.styled-select:focus { border-color: #f4a261; }
.styled-select option { background: #27272a; color: #e4e4e7; }

/* Range slider */
.range-row {
    display: flex; align-items: center; gap: 10px;
    margin-top: 8px;
}
.range-label { font-size: 11px; color: #71717a; font-weight: 500; white-space: nowrap; }
.range-val { font-size: 11px; color: #f4a261; font-weight: 700; min-width: 30px; text-align: right; }
input[type="range"] {
    flex: 1; accent-color: #f4a261;
    cursor: pointer; height: 3px;
}

/* Field label */
.field-label {
    font-size: 10px; font-weight: 600;
    color: #71717a; text-transform: uppercase;
    letter-spacing: 0.5px; margin-bottom: 6px;
    display: block;
}

/* Hint */
.hint-box {
    background: rgba(255,255,255,0.03);
    border-left: 2px solid #f4a261;
    border-radius: 0 6px 6px 0;
    padding: 8px 10px;
    font-size: 11px; color: #71717a;
    line-height: 1.5;
    margin-top: 8px;
}

/* ============================================
   DOWNLOAD BUTTON
   ============================================ */
.btn-download {
    width: 100%;
    background: linear-gradient(135deg, #f4a261, #e76f51);
    color: #18181b;
    border: none;
    border-radius: 10px;
    padding: 13px 16px;
    font-size: 14px; font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(244,162,97,0.35);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(244,162,97,0.45);
}
.btn-download:disabled {
    background: #3f3f46 !important;
    color: #71717a !important;
    box-shadow: none !important;
    transform: none !important;
    cursor: not-allowed;
}

/* Status bar bên dưới button */
.status-bar {
    margin-top: 8px;
    font-size: 11px; color: #52525b;
    text-align: center;
    min-height: 16px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: 280px;
    padding: 24px;
    min-height: 100vh;
}

/* Header main */
.main-header {
    margin-bottom: 20px;
    display: flex; align-items: center; justify-content: space-between;
}
.main-header h1 {
    font-size: 16px; font-weight: 700; color: #18181b;
    margin: 0;
}
.main-header .badge-count {
    background: #f4a261;
    color: #18181b;
    font-size: 11px; font-weight: 700;
    padding: 3px 9px; border-radius: 20px;
}

/* ============================================
   FRAME GRID
   ============================================ */
.frame-col { margin-bottom: 16px; display: flex; justify-content: center; }

.scale-container { position: absolute; top: 0; left: 0; transform-origin: top left; }

.workspace {
    margin: auto; position: relative; width: 500px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    background: #fff; overflow: hidden; border-radius: 6px;
    border: 2px solid transparent;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.workspace:hover {
    border-color: #f4a261;
    box-shadow: 0 8px 30px rgba(244,162,97,0.3);
}
.cropper-wrapper {
    position: absolute; top: 0; left: 0; width: 500px;
    background: repeating-conic-gradient(#f0f0f0 0% 25%, transparent 0% 50%) 50% / 20px 20px;
}

/* Logo per-frame */
.logo {
    position: absolute; left: 30px; top: 30px;
    cursor: grab; z-index: 20;
    transform-origin: top left;
    max-width: 45%;
    transition: outline 0.15s;
}
.logo:hover { outline: 2px dashed rgba(244,162,97,0.7); border-radius: 3px; }
.logo:active { cursor: grabbing; }

/* Scroll hint overlay (Logo) */
.logo-scroll-hint {
    position: absolute; z-index: 25;
    background: rgba(244,162,97,0.9);
    color: #18181b; font-size: 10px; font-weight: 600;
    padding: 3px 7px; border-radius: 4px;
    pointer-events: none;
    opacity: 0; transition: opacity 0.3s;
    white-space: nowrap;
}

/* Logo Shape Classes */
.logo { box-sizing: border-box; background-clip: padding-box; }
.logo.shape-none { border-radius: 0; }
.logo.shape-pill { border-radius: 9999px; }
.logo.shape-bottom { border-radius: 0 0 24px 24px; }
.logo.shape-left { border-radius: 9999px 0 0 9999px; }
.logo.shape-right { border-radius: 0 9999px 9999px 0; }

/* Logo BG Classes */
.logo.bg-transparent { background: transparent; padding: 0; box-shadow: none; }
.logo.bg-white { background: #ffffff; padding: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
.logo.bg-black { background: #18181b; padding: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }

/* Logo Shape/Bg Picker Buttons */
.logo-bg-picker .bg-btn {
    cursor: pointer; transition: all 0.2s; box-sizing: border-box;
}
.logo-bg-picker .bg-btn:hover { transform: scale(1.05); }
.logo-bg-picker .bg-btn.active { outline: 2px solid #f4a261; border-color: transparent !important; }

.logo-shapes .shape-btn {
    flex: 1; height: 18px; 
    background: rgba(255,255,255,0.05); 
    border: 1px solid rgba(255,255,255,0.1); 
    cursor: pointer; transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) inset;
}
.logo-shapes .shape-btn:hover { background: rgba(255,255,255,0.15); }
.logo-shapes .shape-btn.active { 
    background: #f4a261; border-color: #f4a261; 
    box-shadow: 0 0 8px rgba(244,162,97,0.8);
}

/* Image zoom hint overlay */
.image-zoom-hint {
    position: absolute; z-index: 25;
    background: rgba(24, 24, 27, 0.85);
    color: #f4f4f5; font-size: 14px; font-weight: 700;
    padding: 8px 16px; border-radius: 20px;
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0; transition: opacity 0.2s;
    display: flex; align-items: center; gap: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}
.image-zoom-hint.visible { opacity: 1; }

.footer {
    position: absolute; bottom: 0; left: 0;
    width: 500px; min-height: 40px; height: auto;
    background: white;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    text-align: center; font-weight: bold; color: #333;
    z-index: 10; border-top: 1px solid #eee;
    padding: 6px 10px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Kiểu Pill nổi (như trong ảnh mẫu) */
.footer.footer-pill {
    width: calc(100% - 40px); /* Margin 20px ra 2 bên */
    left: 20px;
    bottom: 20px;
    border-radius: 40px;
    border-top: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    background: #ffffff;
    padding: 10px 16px;
}

/* Kiểu Ẩn */
.footer.footer-none {
    display: none !important;
}

/* Cropper overrides */
.cropper-view-box { outline: 0 !important; }
.cropper-point { display: none !important; }
.cropper-modal { background-color: transparent !important; }

/* Empty state */
.empty-state {
    text-align: center; color: #a1a1aa;
    margin-top: 18vh; font-size: 16px; width: 100%;
}
.empty-state h2 { font-size: 22px; font-weight: 700; color: #52525b; margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ============================================
   RESPONSIVE
   ============================================ */
/* ============================================
   FRAME EDIT BUTTON (hover trên frame)
   ============================================ */
.frame-edit-btn {
    position: absolute; top: 12px; right: 12px; z-index: 30;
    background: #f4a261;
    color: #18181b; font-size: 14px; font-weight: 800;
    padding: 8px 16px; border-radius: 8px;
    cursor: pointer; opacity: 0;
    transition: all 0.2s;
    pointer-events: auto;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.frame-edit-btn:hover { background: #e76f51; transform: scale(1.05); }
.workspace:hover .frame-edit-btn { opacity: 1; }

/* ============================================
   EDIT MODAL
   ============================================ */
.edit-modal {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.22s ease;
}
.edit-modal.open { opacity: 1; pointer-events: all; }

.modal-overlay {
    position: absolute; inset: 0;
    background: rgba(10,10,10,0.75);
    backdrop-filter: blur(4px);
}

.modal-panel {
    position: relative; z-index: 1;
    background: #18181b;
    border-radius: 16px;
    width: min(1140px, 96vw);
    max-height: 92vh;
    display: flex; flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
    transform: scale(0.95);
    transition: transform 0.22s ease;
}
.edit-modal.open .modal-panel { transform: scale(1); }

.modal-header {
    padding: 16px 20px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}
.modal-title {
    font-size: 15px; font-weight: 700; color: #f4f4f5;
}
.modal-close {
    background: rgba(255,255,255,0.06); border: none;
    color: #a1a1aa; font-size: 16px;
    width: 32px; height: 32px; border-radius: 8px;
    cursor: pointer; transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: rgba(255,255,255,0.12); color: #fff; }

.modal-body {
    display: flex; flex: 1; overflow: hidden;
}

/* Preview side */
.modal-preview-wrap {
    flex: 1.4; background: #09090b;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 20px; gap: 10px;
    min-width: 0;
}
.modal-crop-area {
    margin: 0 auto;
    width: 100%;
    height: 100%;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative;
    background: transparent;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
/* Cropper inside modal */
#editModal .cropper-container { cursor: grab; }
#editModal .cropper-container:active { cursor: grabbing; }
#editModal .cropper-crop-box { border: none; }
#editModal .cropper-view-box { outline: none; }
#editModal .cropper-face { background: transparent; }
.modal-preview-label {
    font-size: 11px; color: #52525b; font-weight: 500;
}

/* Controls side (Chuẩn Pro Lightroom UX) */
.modal-controls {
    width: 380px; flex-shrink: 0;
    padding: 12px;
    display: flex; flex-direction: column; gap: 10px;
    overflow-y: auto;
    border-left: 1px solid rgba(255,255,255,0.06);
    background: #121214;
}

.modal-card {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex; flex-direction: column; gap: 8px;
}

.modal-card-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #a1a1aa;
}

.modal-divider {
    height: 1px; background: rgba(255,255,255,0.07);
    margin: 2px 0;
}

.preset-chip {
    background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1);
    color: #d4d4d8; border-radius: 6px; padding: 6px 12px; font-size: 11px;
    cursor: pointer; transition: all 0.15s; font-weight: 600;
}
.preset-chip:hover {
    background: rgba(255, 255, 255, 0.15);
}
.preset-chip.active {
    background: #f4a261; color: #1e1e1e; font-weight: bold; border-color: #f4a261;
}

.modal-control-row { display: flex; flex-direction: column; gap: 7px; }

.modal-control-label {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; font-weight: 600; color: #a1a1aa;
}
.modal-val { color: #f4a261; font-weight: 700; font-size: 12px; min-width: 36px; text-align: right; }

.modal-controls input[type="range"] {
    width: 100%; accent-color: #f4a261; cursor: pointer;
}

.modal-actions {
    display: flex; gap: 8px; margin-top: 4px;
}
.modal-btn {
    flex: 1; padding: 10px; border-radius: 8px;
    font-size: 13px; font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer; border: none;
    transition: all 0.15s;
}
.modal-btn-ghost {
    background: rgba(255,255,255,0.06); color: #a1a1aa;
}
.modal-btn-ghost:hover { background: rgba(255,255,255,0.1); color: #e4e4e7; }
.modal-btn-apply {
    background: linear-gradient(135deg, #f4a261, #e76f51);
    color: #18181b;
    box-shadow: 0 3px 10px rgba(244,162,97,0.3);
}
.modal-btn-apply:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(244,162,97,0.4);
}

.modal-note {
    font-size: 10px; color: #3f3f46; margin: 0;
    line-height: 1.5; margin-top: auto;
}

/* Preset pills */
.modal-presets {
    display: flex; flex-direction: column; gap: 7px;
}
.modal-presets-label {
    font-size: 10px; font-weight: 600; color: #52525b;
    text-transform: uppercase; letter-spacing: 0.4px;
}
.modal-presets-grid {
    display: flex; flex-wrap: wrap; gap: 5px;
}
.preset-pill {
    padding: 5px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer; border: 1px solid #3f3f46;
    background: rgba(255,255,255,0.04); color: #a1a1aa;
    transition: all 0.15s;
    white-space: nowrap;
}
.preset-pill:hover {
    background: rgba(255,255,255,0.1); color: #e4e4e7;
    border-color: #71717a;
    transform: translateY(-1px);
}
.preset-pill.warm  { border-color: #92400e; color: #fbbf24; }
.preset-pill.warm:hover  { background: rgba(251,191,36,0.1); }
.preset-pill.cool  { border-color: #1e3a5f; color: #7dd3fc; }
.preset-pill.cool:hover  { background: rgba(125,211,252,0.1); }
.preset-pill.reset-pill { border-color: #f4a261; color: #f4a261; }
.preset-pill.reset-pill:hover { background: rgba(244,162,97,0.12); }

@media (max-width: 600px) {
    .modal-body { flex-direction: column; }
    .modal-controls { width: 100%; border-left: none; border-top: 1px solid rgba(255,255,255,0.06); }
}
