/* Tools Integration Styles */

/* 工具标题区域 */
.tool-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 0 20px;
    animation: fadeInDown 0.5s ease;
}

.tool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 20px;
    margin-bottom: 1.5rem;
    color: #10b981;
}

.tool-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tool-description {
    font-size: 1.125rem;
    color: #6b7280;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 标签导航 */
.tool-tabs-container {
    width: 100%;
    margin-bottom: 2rem;
    background: white;
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}

.tool-tabs {
    display: flex;
    gap: 8px;
}

.tool-tab {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tool-tab:hover {
    background: #f3f4f6;
    color: #374151;
}

.tool-tab.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.tool-tab i {
    width: 18px;
    height: 18px;
}

/* Tool Content */
.tool-content {
    animation: fadeIn 0.3s ease;
}

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

/* Image Converter Layout */
.converter-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.converter-left {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.converter-right {
    background: white;
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    min-height: 600px;
    overflow: hidden;
    width: 100%;
    max-width: none;
    flex: 1;
}

/* Ensure proper inheritance of panel styles */
.converter-right .panel-card {
    box-shadow: none;
    border: none;
    border-radius: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.converter-right .preview-header {
    border-radius: 20px 20px 0 0;
}

/* Hide toolbar in the new layout */
.converter-right .toolbar {
    display: none;
}

/* Fix canvas placeholder display */
.converter-right .canvas-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hide zoom controls in converter */
.converter-right .zoom-controls {
    display: none;
}

/* Make canvas container full width */
.converter-right .canvas-container {
    padding: 2rem;
    background: transparent;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Ensure canvas wrapper takes remaining space */
.converter-right .canvas-scroll {
    flex: 1;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.converter-right .canvas-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.converter-right .canvas-placeholder h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin: 1rem 0 0.5rem;
}

.converter-right .canvas-placeholder p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.converter-right .placeholder-icon {
    width: 64px;
    height: 64px;
    color: #d1d5db;
    margin: 0 auto 1rem auto;
    display: block;
}

/* Pixel Planner Styles */
.planner-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.planner-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.canvas-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #f3f4f6 100%);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
    min-height: 600px;
    position: relative;
    overflow: hidden;
}

/* Drawing Tools */
.drawing-tools {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.tool-btn {
    width: 100%;
    aspect-ratio: 1;
    background: #f3f4f6;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: #e5e7eb;
    transform: translateY(-2px);
}

.tool-btn.active {
    background: #10b981;
    border-color: #059669;
    color: white;
}

.tool-btn i {
    width: 24px;
    height: 24px;
}

/* Current Color */
.current-color-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 12px;
}

.current-color-display {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    border: 3px solid #e5e7eb;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Palette Grid */
.palette-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.palette-color {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.palette-color:hover {
    transform: scale(1.15);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.palette-color.selected {
    border-color: #10b981;
    transform: scale(1.1);
}

/* Canvas Container */
.canvas-container {
    position: relative;
    display: inline-block;
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.canvas-container:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

#pixelCanvas, #gridOverlay {
    display: block;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

#pixelCanvas {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#gridOverlay {
    position: absolute;
    top: 32px;
    left: 32px;
    pointer-events: none;
    opacity: 0.4;
}

/* Canvas Controls */
.canvas-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 1rem;
}

.size-btn {
    flex: 1;
    padding: 8px;
    background: #f3f4f6;
    border: 2px solid transparent;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.size-btn:hover {
    background: #e5e7eb;
}

.size-btn.active {
    background: #10b981;
    color: white;
    border-color: #059669;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    flex: 1;
    padding: 10px;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.action-btn:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

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

/* Color Palette Page */
.palette-layout {
    max-width: 1200px;
    margin: 0 auto;
}

.palette-tabs {
    display: flex;
    gap: 8px;
    margin: 2rem 0;
    padding: 8px;
    background: #f9fafb;
    border-radius: 12px;
    width: fit-content;
}

.palette-tab {
    padding: 8px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.palette-tab:hover {
    background: white;
    color: #374151;
}

.palette-tab.active {
    background: white;
    color: #10b981;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Colors Grid */
.colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.color-tile-large {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.color-tile-large:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.color-tile-large.locked {
    cursor: not-allowed;
    opacity: 0.8;
}

.color-preview {
    height: 100px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lock-icon {
    width: 24px;
    height: 24px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.color-info {
    padding: 12px;
    background: white;
}

.color-name {
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.color-hex {
    font-family: monospace;
    color: #6b7280;
    font-size: 14px;
}

/* Copy Toast */
.copy-toast {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #10b981;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    animation: toastAnim 2s ease;
    pointer-events: none;
}

@keyframes toastAnim {
    0% {
        opacity: 0;
        transform: translate(-50%, -30%);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -70%);
    }
}

/* Pixel Planner Enhanced UI */
.planner-canvas-tools {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1rem;
    position: absolute;
    top: 1rem;
    right: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

/* Canvas area decorative elements */
.canvas-panel::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.canvas-panel::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -30px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.grid-toggle-btn {
    padding: 8px 16px;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.grid-toggle-btn:hover {
    background: #e5e7eb;
}

.grid-toggle-btn.active {
    background: #10b981;
    color: white;
}

/* Color Palette Enhanced UI */
.palette-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 2rem;
}

.color-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    cursor: pointer;
}

.color-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.color-card-preview {
    height: 120px;
    position: relative;
}

.color-card-info {
    padding: 16px;
    text-align: center;
}

.color-card-name {
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.color-card-hex {
    font-family: monospace;
    color: #6b7280;
    font-size: 14px;
}

.color-card.locked .color-card-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-card.locked .lock-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
}

/* Search and Filter for Color Palette */
.palette-search {
    max-width: 600px;
    margin: 0 auto 2rem;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 20px 12px 48px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.2s ease;
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    width: 20px;
    height: 20px;
    pointer-events: none;
}

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

@media (max-width: 768px) {
    .tool-title {
        font-size: 2rem;
    }
    
    .tool-description {
        font-size: 1rem;
    }
    
    .tool-header {
        margin-bottom: 2rem;
    }
}

@media (max-width: 1024px) {
    .planner-layout {
        grid-template-columns: 1fr;
    }
    
    .planner-sidebar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .tool-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tool-tab {
        min-width: 140px;
        font-size: 14px;
        padding: 10px 16px;
    }
    
    .colors-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .color-preview {
        height: 80px;
    }
}