/* ==========================================================================
   PicPulse Design System & Styling
   ========================================================================== */

/* Design Tokens & Variables */
:root {
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Theme Colors (Premium Dark Mode) */
    --bg-main: hsl(230, 20%, 6%);
    --bg-sidebar: hsl(230, 20%, 9%);
    --bg-card: hsla(230, 20%, 12%, 0.6);
    --border-color: hsla(230, 20%, 20%, 0.4);
    --border-focus: hsl(210, 100%, 60%);
    
    --text-primary: hsl(0, 0%, 96%);
    --text-muted: hsl(230, 10%, 65%);
    --text-tips: hsl(230, 10%, 45%);
    
    /* Accents (Neon gradients) */
    --accent-blue: hsl(210, 100%, 55%);
    --accent-cyan: hsl(180, 100%, 50%);
    --accent-purple: hsl(270, 100%, 60%);
    --accent-gradient: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    
    --toast-success: hsl(140, 70%, 45%);
    --toast-error: hsl(0, 70%, 50%);
    
    /* Spacing & Borders */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --sidebar-width: 280px;
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Global */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-primary);
}

/* Sidebar Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.logo-icon i {
    width: 22px;
    height: 22px;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition-smooth);
}

.nav-item i {
    width: 20px;
    height: 20px;
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: hsla(230, 20%, 15%, 0.5);
}

.nav-item.active {
    color: var(--text-primary);
    background: var(--accent-gradient);
    box-shadow: 0 4px 15px -3px rgba(124, 58, 237, 0.4);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: auto;
}

.lang-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.lang-selector:hover {
    border-color: var(--accent-blue);
}

.lang-selector select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    flex-grow: 1;
}

/* 兼容性样式：强制设定展开下拉框时的背景与文字颜色，防止浏览器默认白底 */
.lang-selector select option {
    background-color: hsl(230, 20%, 12%); /* 暗色卡片背景 */
    color: hsl(0, 0%, 96%); /* 亮色文字 */
}

/* Main Content Layout */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
}

.header-info {
    flex-grow: 1;
}

/* Language Selector Premium Enhancements */
.lang-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 12px;
    backdrop-filter: blur(10px);
    transition: var(--transition-smooth);
    width: 100%;
}

.lang-selector:hover {
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

.lang-selector i {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

#lang-select {
    background: transparent !important;
    border: none !important;
    padding: 12px 24px 12px 4px !important; /* Sizable comfortable touch padding */
    font-size: 15px !important;             /* Increased font size for readability */
    font-weight: 600 !important;
    cursor: pointer;
    width: 100%;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Custom clean chevron icon */
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 4px center !important;
    background-size: 16px !important;
}

.header-lang {
    max-width: 180px; /* Sizable container for comfortable clicking */
    width: 100%;
}

.main-header h1 {
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 8px;
}

.main-header p {
    color: var(--text-muted);
    font-size: 16px;
}

/* Tab Panels */
.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-pane.active {
    display: block;
}

/* Home Grid Menu */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    padding: 32px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--shadow-premium);
}

.feature-card:hover {
    transform: translateY(-8px);
    border-color: hsla(210, 100%, 60%, 0.4);
    box-shadow: 0 15px 35px -10px rgba(59, 130, 246, 0.25);
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 8px;
}

.card-icon i {
    width: 28px;
    height: 28px;
}

.cropper-color { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); }
.compressor-color { background: linear-gradient(135deg, #10b981 0%, #047857 100%); }
.stitcher-color { background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%); }
.pipette-color { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }

.feature-card h3 {
    font-size: 20px;
    font-weight: 600;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 14px;
    flex-grow: 1;
}

.card-action {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--accent-blue);
    font-size: 14px;
    margin-top: 8px;
    transition: var(--transition-smooth);
}

.feature-card:hover .card-action {
    color: var(--text-primary);
}

/* Tool Settings Panel & Layout */
.tool-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    align-items: start;
    max-width: 1200px;
}

.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
}

.panel-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.panel-card h3 {
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

/* Forms & UI Controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-row {
    display: flex;
    gap: 15px;
    width: 100%;
}

.half-width {
    flex: 1;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Segmented Buttons */
.btn-group-segmented {
    display: flex;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    padding: 4px;
    border-radius: var(--radius-sm);
    gap: 4px;
}

.segmented-btn {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.segmented-btn:hover {
    color: var(--text-primary);
}

.segmented-btn.active {
    background-color: var(--bg-card);
    color: var(--text-primary);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Range Slider */
.range-slider-container {
    display: flex;
    align-items: center;
    gap: 14px;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    transition: var(--transition-smooth);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.range-val {
    font-size: 13px;
    font-weight: 600;
    min-width: 45px;
    text-align: right;
}

/* Standard Inputs & Selects */
select, input[type="number"], input[type="text"] {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font-body);
    outline: none;
    transition: var(--transition-smooth);
}

select:focus, input[type="number"]:focus, input[type="text"]:focus {
    border-color: var(--border-focus);
}

/* Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
}

.checkbox-container input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Numeric Inputs With Suffixes */
.input-container {
    display: flex;
    position: relative;
}

.input-container input {
    width: 100%;
    padding-right: 45px;
}

.input-suffix {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

.input-tip {
    font-size: 12px;
    color: var(--text-tips);
}

/* Action Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-smooth);
}

.btn-full {
    width: 100%;
}

.btn i {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    opacity: 0.95;
    box-shadow: 0 4px 15px -3px rgba(124, 58, 237, 0.4);
}

.btn-secondary {
    background: var(--bg-sidebar);
    border-color: var(--border-color);
    color: var(--text-primary);
}

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

.btn-danger {
    background: #ef4444;
    border-color: #dc2626;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
    box-shadow: 0 4px 15px -3px rgba(239, 68, 68, 0.4);
}

.btn-outline {
    background: transparent;
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.btn-outline:hover {
    background-color: var(--accent-blue);
    color: white;
}

/* Dropzone workspace */
.tool-workspace {
    flex-grow: 1;
    min-height: 500px;
}

.dropzone-area {
    border: 2px dashed var(--border-color);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    gap: 20px;
    min-height: 450px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.dropzone-area:hover, .dropzone-area.drag-over {
    border-color: var(--accent-blue);
    background-color: hsla(210, 100%, 60%, 0.05);
}

.dropzone-icon {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
}

.dropzone-area h4 {
    font-size: 18px;
    font-weight: 600;
}

.dropzone-area p {
    color: var(--text-tips);
    font-size: 14px;
}

.hidden-input {
    display: none;
}

.hidden {
    display: none !important;
}

/* Workspace Preview Panel */
.workspace-preview {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    width: 100%;
    max-width: 700px;
}

.preview-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #090a0f;
    border-radius: var(--radius-md);
    padding: 16px;
    width: 100%;
    position: relative;
    border: 1px dashed var(--border-color);
}

/* Cropper Workspace Specific */
.canvas-container {
    position: relative;
    max-width: 360px;
    width: 100%;
    margin: auto;
    flex-shrink: 0;
}

#cropper-canvas {
    display: block;
    max-width: 100%;
    max-height: 260px;
    width: auto;
    height: auto;
}

.grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.cropper-results-panel {
    width: 100%;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.cropper-results-panel h4 {
    margin-bottom: 20px;
    font-size: 15px;
    color: var(--text-muted);
}

.grid-tiles-preview {
    display: grid;
    gap: 6px;
    width: 100%;
}

/* Simple 2x2, 3x3 layout logic */
.grid-tiles-preview.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-tiles-preview.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-tiles-preview.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-tiles-preview.grid-5 { grid-template-columns: repeat(5, 1fr); }

.tile-box {
    position: relative;
    aspect-ratio: 1/1;
    background-color: #0d0e14;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.tile-box:hover {
    transform: scale(1.02);
    border-color: var(--accent-blue);
}

.tile-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tile-overlay-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 13px;
    font-weight: 600;
    gap: 6px;
    opacity: 0;
    transition: var(--transition-smooth);
}

.tile-box:hover .tile-overlay-hover {
    opacity: 1;
}

.tile-overlay-hover i {
    width: 18px;
    height: 18px;
}

/* Compressor Workspace Specific */
.comparison-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    width: 100%;
}

.preview-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.preview-panel h5 {
    font-size: 16px;
    color: var(--text-muted);
}

.preview-box {
    background: #090a0f;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.info-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.info-tag {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.info-tag.highlight {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.info-tag.savings {
    background-color: hsla(140, 70%, 45%, 0.15);
    border-color: var(--toast-success);
    color: hsl(140, 80%, 65%);
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(9, 10, 15, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#stitcher-direction {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

/* Stitcher Workspace Specific */
.stitcher-preview-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.grid-preview-box {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    background: #090a0f;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-premium);
}

.stitcher-interactive-grid {
    display: grid;
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s, padding 0.2s, gap 0.2s;
}

.grid-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: grab;
    transition: transform 0.2s, opacity 0.2s, border-color 0.2s;
    user-select: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.grid-cell:active {
    cursor: grabbing;
}

.grid-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none; /* Let drag events trigger on parent div */
}

.grid-cell-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: rgba(239, 68, 68, 0.9);
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition-smooth);
    z-index: 10;
    line-height: 1;
}

.grid-cell:hover .grid-cell-delete {
    opacity: 1;
}

.grid-cell-delete:hover {
    background-color: rgb(220, 38, 38);
    transform: scale(1.1);
}

.grid-cell.dragging {
    opacity: 0.3;
    border-color: var(--accent-blue);
    transform: scale(0.95);
}

.upload-cell {
    background-color: var(--bg-sidebar);
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.upload-cell:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background-color: hsla(210, 100%, 60%, 0.05);
}

.upload-cell i {
    width: 28px;
    height: 28px;
}

.stitcher-interactive-grid {
    display: grid;
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    transition: background-color 0.2s, padding 0.2s, gap 0.2s;
}
.stitcher-interactive-grid .grid-cell {
    aspect-ratio: 1 / 1;
}
.stitcher-interactive-grid .grid-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.stitcher-interactive-grid .upload-cell {
    aspect-ratio: 1 / 1;
}

.color-picker-input-wrapper {
    display: flex;
    gap: 10px;
}

.color-picker-input-wrapper input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
}

.color-picker-input-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-input-wrapper input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.color-picker-input-wrapper input[type="text"] {
    flex-grow: 1;
}

/* Color Pipette Workspace Specific */
.pipette-canvas-container {
    position: relative;
    display: inline-block;
    cursor: crosshair;
}

#pipette-canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.pipette-help-text {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: hsla(210, 100%, 60%, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    color: var(--accent-blue);
    font-size: 13px;
    font-weight: 500;
}

.pipette-help-text i {
    width: 18px;
    height: 18px;
}

.loupe {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 3px solid white;
    border-radius: 50%;
    pointer-events: none;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    display: none;
    transform: translate(-50%, -50%);
    z-index: 10;
}

#loupe-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.loupe-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    border: 1px solid red;
    background-color: transparent;
    transform: translate(-50%, -50%);
}

.color-preview-box-large {
    width: 100%;
    height: 120px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: white;
    box-shadow: var(--shadow-premium);
}

.color-detail-row {
    position: relative;
}

.copy-input-container {
    display: flex;
    position: relative;
}

.copy-input-container input {
    width: 100%;
    padding-right: 48px;
}

.btn-copy {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: var(--transition-smooth);
}

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

.btn-copy i {
    width: 16px;
    height: 16px;
}

/* Google Ads Placeholder styling */
.ad-placeholder {
    background-color: hsla(230, 20%, 9%, 0.4);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 10px;
    position: relative;
}

.ad-label {
    position: absolute;
    top: 4px;
    left: 8px;
    font-size: 9px;
    color: var(--text-tips);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    pointer-events: none;
}


.footer-ad {
    width: 100%;
    height: 110px;
    margin-top: 40px;
}

.sidebar-ad {
    width: 100%;
    min-height: 220px;
    margin-top: 10px;
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    padding: 14px 24px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
    transition: var(--transition-smooth);
}

.toast-notification.success {
    border-left: 4px solid var(--toast-success);
}

.toast-notification.error {
    border-left: 4px solid var(--toast-error);
}

.toast-notification i {
    width: 20px;
    height: 20px;
}

.toast-notification.success i { color: var(--toast-success); }
.toast-notification.error i { color: var(--toast-error); }

/* App Footer */
.app-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    margin-top: auto;
    text-align: center;
}

.app-footer p {
    color: var(--text-tips);
    font-size: 13px;
}

/* Keyframe Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .tool-layout {
        grid-template-columns: 1fr;
    }
    
    .comparison-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 16px;
    }
    
    .logo-area {
        margin-bottom: 20px;
    }
    
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
    }
    
    .nav-item {
        padding: 10px 14px;
        white-space: nowrap;
    }
    
    .sidebar-footer {
        display: none; /* Hide sidebar footer/ad/lang selector on mobile, let it show in menu or footer */
    }
    
    .app-container {
        flex-direction: column;
    }
    
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    .main-header h1 {
        font-size: 28px;
    }
}

/* ==========================================================================
   Color Pipette Refactored Layout
   ========================================================================== */

/* Wrapper: image area + zoom panel side by side */
.pipette-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    width: 100%;
}

.pipette-main-area {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

/* The scrollable canvas container */
.pipette-scroll-wrapper {
    overflow: auto;
    max-height: 580px;
    border-radius: var(--radius-md);
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
}

/* Canvas container is sized to match zoom level via JS */
.pipette-canvas-container {
    position: relative;
    display: inline-block;
    line-height: 0;
    max-width: 100%; /* never overflow its scroll wrapper */
}

#pipette-canvas {
    display: block;
    cursor: crosshair;
}

/* Crosshair overlay — a small + marker positioned via JS */
.pipette-crosshair {
    position: absolute;
    pointer-events: none;
    display: none;
    box-sizing: border-box;
}
.pipette-crosshair::before,
.pipette-crosshair::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 3px rgba(0,0,0,0.7);
}
/* Horizontal bar */
.pipette-crosshair::before {
    width: 100%;
    height: 1.5px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}
/* Vertical bar */
.pipette-crosshair::after {
    width: 1.5px;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

/* Help text bar */
.pipette-help-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}
.pipette-help-text i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.7;
}

/* Zoom Preview Panel — fixed-width column on the right */
.pipette-zoom-panel {
    flex: 0 0 180px;
    display: none;          /* shown by JS after image load */
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    position: sticky;
    top: 0;
}

.zoom-panel-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    width: 100%;
}
.zoom-panel-header i {
    width: 13px;
    height: 13px;
    opacity: 0.7;
}

#zoom-preview-canvas {
    width: 156px;
    height: 156px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.08);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
}

.zoom-coords {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 4px 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 4px;
    width: 100%;
    text-align: center;
}

/* Responsive: stack vertically on narrow screens */
@media (max-width: 860px) {
    .pipette-layout {
        flex-direction: column;
    }
    .pipette-zoom-panel {
        flex: 0 0 auto;
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    #zoom-preview-canvas {
        width: 120px;
        height: 120px;
    }
}

/* ==========================================================================
   App Footer & Policy Links (PicLocal)
   ========================================================================== */

.app-footer {
    margin-top: auto;
    padding: 20px 0 10px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.app-footer p {
    font-size: 12px;
    color: var(--text-tips);
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-smooth);
    padding: 2px 4px;
    border-radius: 4px;
}

.footer-links a:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

.footer-sep {
    font-size: 12px;
    color: var(--text-tips);
    user-select: none;
}

/* ==========================================================================
   Batch Image Watermark Tool Styles
   ========================================================================== */

.watermark-color {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
}

.watermark-grid-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 140px;
    margin: 8px auto 0;
}

.watermark-grid-selector .grid-cell {
    aspect-ratio: 1 / 1;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.watermark-grid-selector .grid-cell:hover {
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.05);
}

.watermark-grid-selector .grid-cell.active {
    background: var(--accent-gradient);
    border-color: var(--accent-blue);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
}

.watermark-layout-workspace {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    width: 100%;
    align-items: start;
}

.watermark-file-sidebar {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 420px;
    overflow-y: auto;
}

.watermark-file-sidebar h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.watermark-file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.watermark-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    user-select: none;
    min-width: 0;
}

.watermark-file-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-blue);
}

.watermark-file-item.active {
    background: rgba(59, 130, 246, 0.12);
    border-color: var(--accent-blue);
    box-shadow: inset 0 0 8px rgba(59, 130, 246, 0.15);
}

.watermark-item-thumb {
    width: 44px;
    height: 44px;
    border-radius: 6px;
    object-fit: cover;
    background-color: #000;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.watermark-item-info {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.watermark-item-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.watermark-item-size {
    font-size: 11px;
    color: var(--text-tips);
}

.watermark-item-remove {
    background: transparent;
    border: none;
    color: var(--text-tips);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.watermark-item-remove:hover {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.15);
}

.watermark-preview-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.watermark-preview-main h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.watermark-file-sidebar::-webkit-scrollbar {
    width: 6px;
}
.watermark-file-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.watermark-file-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
.watermark-file-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-tips);
}

@media (max-width: 1024px) {
    .watermark-layout-workspace {
        grid-template-columns: 1fr;
    }
    .watermark-file-sidebar {
        max-height: 300px;
    }
}

#watermark-canvas {
    max-width: 100%;
    max-height: 380px;
    height: auto;
    width: auto;
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    background-color: #0b0c10;
}

.watermark-preview-wrapper {
    max-height: 420px;
    padding: 12px;
}

