/* Tool Tabs Container */
.tool-tabs-container {
    margin-bottom: 32px;
}

/* Tool Tabs Styling */
.tool-tabs {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: var(--elegant-shadow-medium);
    margin: 20px auto;
    max-width: 600px;
    z-index: 10;
}

.tool-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--premium-stone-600);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tool-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--premium-emerald-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.tool-tab:hover {
    color: var(--premium-emerald);
    transform: translateY(-2px);
}

.tool-tab.active {
    background: var(--premium-emerald);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.tool-tab.active::before {
    opacity: 1;
}

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

/* Tool Header */
.tool-header {
    text-align: center;
    margin-bottom: 32px;
}

.tool-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--premium-stone-800);
    margin-bottom: 12px;
}

.tool-description {
    font-size: 16px;
    color: var(--premium-stone-600);
    max-width: 600px;
    margin: 0 auto;
}

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

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

/* Pixel Planner Styles */
.planner-layout {
    display: flex;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    justify-content: center;
    align-items: flex-start;
}

.tools-panel {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--elegant-shadow-medium);
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.tools-panel h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--premium-stone-800);
    margin-bottom: 12px;
}

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

.tool-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 2px solid var(--premium-stone-200);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    border-color: var(--premium-emerald);
    background: var(--premium-emerald-soft);
}

.tool-btn.active {
    background: var(--premium-emerald);
    border-color: var(--premium-emerald);
    color: white;
}

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

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--premium-stone-700);
}

.settings-group select {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid var(--premium-stone-200);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-group select:focus {
    outline: none;
    border-color: var(--premium-emerald);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.settings-group input[type="checkbox"] {
    margin-right: 8px;
}

.color-selector h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--premium-stone-700);
    margin-bottom: 12px;
}

.current-color {
    width: 100%;
    height: 60px;
    border-radius: 8px;
    border: 2px solid var(--premium-stone-300);
    margin-bottom: 12px;
    cursor: pointer;
}

.quick-colors {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(32px, 1fr));
    gap: 4px;
}

.quick-color-tile {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.quick-color-tile:hover {
    transform: scale(1.1);
    border-color: var(--premium-stone-400);
}

.quick-color-tile.selected {
    border-color: var(--premium-emerald);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.btn-secondary {
    background: var(--premium-stone-100);
    color: var(--premium-stone-700);
}

.btn-secondary:hover {
    background: var(--premium-stone-200);
    transform: translateY(-2px);
}

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

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

.btn-success {
    background: var(--premium-emerald);
    color: white;
}

.btn-success:hover {
    background: var(--premium-emerald-dark);
    transform: translateY(-2px);
}

.canvas-stats {
    background: var(--premium-stone-50);
    border-radius: 8px;
    padding: 16px;
}

.stats-header h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--premium-stone-700);
    margin-bottom: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--premium-emerald);
}

.stat-label {
    font-size: 12px;
    color: var(--premium-stone-600);
}

.canvas-panel {
    flex: 0 1 auto;
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--elegant-shadow-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    max-width: 700px;
}

.canvas-container {
    position: relative;
    display: inline-block;
}

#drawingCanvas,
#gridOverlay {
    position: absolute;
    border: 2px solid var(--premium-stone-300);
    image-rendering: pixelated;
    max-width: 100%;
    height: auto;
}

#drawingCanvas {
    background: white;
    cursor: crosshair;
}

#gridOverlay {
    pointer-events: none;
    z-index: 1;
}

/* Color Palette Tool Styles */
.palette-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.palette-header {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--elegant-shadow-medium);
    margin-bottom: 24px;
}

.palette-header h2 {
    font-size: 28px;
    color: var(--premium-stone-800);
    margin-bottom: 16px;
}

.palette-header p {
    color: var(--premium-stone-600);
    font-size: 16px;
    line-height: 1.6;
}

.palette-tabs {
    display: flex;
    gap: 8px;
    background: white;
    padding: 8px;
    border-radius: 12px;
    box-shadow: var(--elegant-shadow-soft);
    margin-bottom: 24px;
}

.palette-tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--premium-stone-600);
    font-weight: 600;
    font-size: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.palette-tab:hover {
    background: var(--premium-stone-50);
    color: var(--premium-emerald);
}

.palette-tab.active {
    background: var(--premium-emerald);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.palette-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--elegant-shadow-medium);
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    margin-top: 24px;
}

.color-tile {
    position: relative;
    height: 60px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
}

.color-tile:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: var(--elegant-shadow-medium);
}

.color-lock {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-lock i {
    width: 12px;
    height: 12px;
    color: white;
}

.color-tile .color-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 11px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.color-tile:hover .color-name {
    opacity: 1;
}

.color-detail {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-width: 400px;
    width: 90%;
}

.color-detail.active {
    display: block;
}

.color-detail-preview {
    width: 100%;
    height: 120px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.color-detail h3 {
    font-size: 24px;
    color: var(--premium-stone-800);
    margin-bottom: 8px;
}

.color-detail-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.color-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--premium-stone-100);
}

.color-detail-label {
    font-weight: 600;
    color: var(--premium-stone-600);
}

.color-detail-value {
    font-family: monospace;
    color: var(--premium-stone-800);
}

.color-detail-actions {
    display: flex;
    gap: 12px;
}

.color-detail-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-detail-btn.copy {
    background: var(--premium-emerald);
    color: white;
}

.color-detail-btn.copy:hover {
    background: var(--premium-emerald-dark);
    transform: translateY(-2px);
}

.color-detail-btn.close {
    background: var(--premium-stone-100);
    color: var(--premium-stone-700);
}

.color-detail-btn.close:hover {
    background: var(--premium-stone-200);
}

.usage-info {
    background: var(--premium-stone-50);
    border-radius: 12px;
    padding: 20px;
    margin-top: 24px;
}

.usage-info h3 {
    font-size: 18px;
    color: var(--premium-stone-800);
    margin-bottom: 12px;
}

.usage-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.usage-info li {
    padding: 8px 0;
    color: var(--premium-stone-600);
    display: flex;
    align-items: center;
    gap: 8px;
}

.usage-info li::before {
    content: '✓';
    color: var(--premium-emerald);
    font-weight: bold;
}

/* Canvas Size Buttons */
.canvas-controls {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.size-btn {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--premium-stone-200);
    background: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--premium-stone-700);
    cursor: pointer;
    transition: all 0.2s ease;
}

.size-btn:hover {
    border-color: var(--premium-emerald);
    background: var(--premium-emerald-soft);
}

.size-btn.active {
    background: var(--premium-emerald);
    border-color: var(--premium-emerald);
    color: white;
}

/* Canvas Controls Bottom */
.canvas-controls-bottom {
    margin-top: 16px;
    text-align: center;
}

/* Tool Section */
.tool-section {
    margin-bottom: 24px;
}

.tool-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--premium-stone-800);
    margin-bottom: 12px;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.overlay.active {
    display: block;
}

/* Palette Search Styles */
.palette-search-container {
    margin: 20px 0;
}

.palette-search {
    position: relative;
    max-width: 400px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--premium-stone-400);
    width: 20px;
    height: 20px;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 2px solid var(--premium-stone-200);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.2s ease;
    background: white;
}

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

/* Palette Subtitle */
.palette-subtitle {
    color: var(--premium-stone-600);
    font-size: 16px;
    margin-bottom: 24px;
}

/* Color Tile Hover Effects */
.color-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: var(--premium-emerald);
}

/* Copy feedback */
.copy-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--premium-emerald);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Stats update animation */
.stat-value {
    transition: all 0.3s ease;
}

.stat-value.updated {
    transform: scale(1.1);
    color: var(--premium-emerald);
}

/* Tool button enhancements */
.tool-btn svg {
    width: 20px;
    height: 20px;
}

/* Color tile improvements */
.color-tile {
    position: relative;
    overflow: visible;
}

.color-tile .color-name {
    pointer-events: none;
}

/* Canvas container improvements */
.canvas-container {
    position: relative;
    display: inline-block;
    background: #f9fafb;
    padding: 20px;
    border-radius: 12px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

#drawingCanvas,
#gridOverlay {
    cursor: crosshair;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Quick color improvements */
.quick-colors {
    max-width: 100%;
}

.quick-color-tile.selected::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 2px;
    color: white;
    font-size: 10px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .planner-layout {
        flex-direction: column;
        align-items: center;
    }
    
    .tools-panel {
        width: 100%;
        max-width: 600px;
    }
    
    .canvas-panel {
        width: 100%;
        max-width: 800px;
    }
}

@media (max-width: 768px) {
    .tool-tabs {
        padding: 6px;
        gap: 4px;
    }
    
    .tool-tab {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .tool-tab span {
        display: none;
    }
    
    .pixel-planner-container {
        flex-direction: column;
    }
    
    .pp-toolbar {
        width: 100%;
    }
    
    .cp-colors {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .cp-actions {
        flex-direction: column;
    }
    
    .cp-action-btn {
        width: 100%;
    }
    
    .planner-layout {
        padding: 10px;
        gap: 10px;
    }
    
    .tools-panel,
    .canvas-panel {
        padding: 16px;
    }
    
    .canvas-container {
        padding: 10px;
    }
}