/* ==========================================================================
   pixxu.net - Tools Common CSS
   Gemeinsame Styles für alle Tool-Seiten
   ========================================================================== */

/* ==========================================================================
   TOOL PAGES LAYOUT
   ========================================================================== */

/* Tool pages have padding-top for fixed navbar */
body.tool-page {
    padding-top: 76px;
}

/* Tool page hero sections */
body.tool-page .hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: auto;
    padding: 80px 0 40px;
    position: relative;
    overflow: hidden;
}

/* Hero pattern overlay for tool pages */
body.tool-page .hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="25" cy="75" r="1" fill="white" opacity="0.05"/><circle cx="75" cy="25" r="1" fill="white" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

/* Hero content positioning for tool pages */
body.tool-page .hero-content {
    position: relative;
    z-index: 2;
}

/* Hero preview positioning for tool pages */
body.tool-page .hero-preview {
    position: relative;
    z-index: 2;
}

body.tool-page .hero-title {
    color: white;
    background: none;
    -webkit-text-fill-color: white;
    font-size: 3rem;
}

body.tool-page .hero-subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    font-weight: 400;
    line-height: 1.6;
}

.main-content {
    padding: 40px 0 60px;
}

/* ==========================================================================
   CONTROL PANEL
   ========================================================================== */

.control-panel {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 100px;
    height: fit-content;
    /* Removed max-height and overflow for accordion support */
}

/* Panel Section */
.panel-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.panel-section h5,
.panel-section h6 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* ==========================================================================
   PREVIEW PANEL
   ========================================================================== */

.preview-panel {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    min-height: 600px;
    position: sticky;
    top: 100px;
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Improved scroll indicators */
.preview-panel::-webkit-scrollbar {
    width: 6px;
}

.preview-panel::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 3px;
}

.preview-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.preview-panel::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.preview-section {
    margin-bottom: 3rem;
}

.preview-section:last-child {
    margin-bottom: 0;
}

.preview-section h5 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

/* ==========================================================================
   IMAGE PREVIEW WRAPPER
   ========================================================================== */

.image-preview-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
}

/* Optimized Image Container */
.image-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    background: var(--light-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 400px;
    transition: all 0.3s ease;
}

.image-container:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.02);
}

.image-container.has-image:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Perfect centering of image */
.image-container.has-image {
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Preview Image optimized for centered display */
.preview-image {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    display: block;
    margin: auto;
    transition: all 0.3s ease;
}

.image-container.has-image .preview-image {
    width: auto;
    height: auto;
    max-width: calc(100% - 2rem);
    max-height: calc(400px - 2rem);
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* Loading State */
.image-container.loading {
    position: relative;
}

.image-container.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Welcome State centered */
.welcome-state {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 400px;
}

.welcome-content {
    text-align: center;
    max-width: 500px;
    padding: 2rem;
}

.welcome-content h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

/* ==========================================================================
   OVERLAYS (CROP & PIXELATE)
   ========================================================================== */

.crop-overlay,
.pixelate-overlay {
    position: absolute;
    border: 2px solid var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    cursor: move;
    display: none;
    border-radius: 4px;
    z-index: 10;
}

.pixelate-overlay {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.crop-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: nw-resize;
}

.crop-handle.nw { 
    top: -6px; 
    left: -6px; 
}

.crop-handle.ne { 
    top: -6px; 
    right: -6px; 
    cursor: ne-resize; 
}

.crop-handle.sw { 
    bottom: -6px; 
    left: -6px; 
    cursor: sw-resize; 
}

.crop-handle.se { 
    bottom: -6px; 
    right: -6px; 
    cursor: se-resize; 
}

/* ==========================================================================
   ACTION BUTTONS SECTION
   ========================================================================== */

.action-buttons {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.action-buttons .btn-group {
    margin-bottom: 1rem;
}

.action-buttons .btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* History Info Styling */
#historyInfo {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* ==========================================================================
   HERO PREVIEW COMPONENTS
   ========================================================================== */

/* Editor Showcase */
.editor-showcase {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.editor-mockup {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    width: 100%;
    max-width: 400px;
}

.editor-toolbar {
    background: #f1f5f9;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.toolbar-group {
    display: flex;
    gap: 12px;
}

.tool-icon {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.editor-canvas {
    height: 200px;
    background: white;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-placeholder {
    color: var(--text-secondary);
}

/* Favicon Showcase */
.favicon-showcase {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.browser-mockup {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    width: 100%;
    max-width: 400px;
}

.browser-bar {
    background: #f1f5f9;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.browser-dots {
    display: flex;
    gap: 6px;
}

.browser-dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #cbd5e1;
}

.browser-dots span:nth-child(1) { background: #ef4444; }
.browser-dots span:nth-child(2) { background: #f59e0b; }
.browser-dots span:nth-child(3) { background: var(--success-color); }

.browser-address {
    flex: 1;
    background: white;
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.favicon-demo {
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 2px;
}

.browser-content {
    height: 200px;
    background: white;
    position: relative;
}

.content-placeholder {
    background: linear-gradient(90deg, #f1f5f9 25%, transparent 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    height: 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ==========================================================================
   HERO FEATURES
   ========================================================================== */

.hero-features {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.feature-badge {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.feature-badge i {
    color: var(--success-color);
    margin-right: 0.5rem;
}

/* ==========================================================================
   DOWNLOAD SECTION
   ========================================================================== */

.download-info {
    text-align: center;
}

.download-stats {
    background: var(--light-bg);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 992px) {
    body.tool-page .hero-title {
        font-size: 2.5rem;
    }
    
    .control-panel,
    .preview-panel {
        position: static;
        margin-bottom: 2rem;
        max-height: none;
        overflow-y: visible;
    }
    
    .preview-panel {
        min-height: 500px;
    }
    
    .image-container {
        min-height: 350px;
    }
    
    .preview-image {
        max-height: 350px;
    }
    
    .main-content {
        padding: 40px 0;
    }
    
    .action-buttons {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
}

@media (max-width: 768px) {
    body.tool-page .hero-title {
        font-size: 2rem;
    }
    
    .control-panel,
    .preview-panel {
        padding: 1.5rem;
        border-radius: 12px;
    }
    
    .panel-section {
        margin-bottom: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    .image-container {
        min-height: 300px;
    }
    
    .preview-image {
        max-height: 300px;
    }
    
    .welcome-content {
        padding: 1.5rem;
    }
    
    .action-buttons {
        margin-top: 1rem;
        padding-top: 1rem;
    }
    
    .action-buttons .btn-lg {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .editor-mockup,
    .browser-mockup {
        max-width: 300px;
    }
}

@media (max-width: 576px) {
    body.tool-page {
        padding-top: 70px;
    }
    
    body.tool-page .hero-title {
        font-size: 1.75rem;
    }
    
    body.tool-page .hero-section {
        padding: 60px 0 40px;
    }
    
    .main-content {
        padding: 30px 0;
    }
    
    .control-panel,
    .preview-panel {
        padding: 1rem;
        border-radius: 12px;
    }
    
    .panel-section {
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }
    
    .image-container {
        min-height: 250px;
    }
    
    .preview-image {
        max-height: 250px;
    }
    
    .welcome-content {
        padding: 1rem;
    }
    
    .hero-features {
        flex-direction: column;
        align-items: center;
    }
    
    .feature-badge {
        width: 100%;
        text-align: center;
    }
    
    .action-buttons .btn-group {
        flex-direction: column;
    }
    
    .action-buttons .btn-group .btn {
        border-radius: 8px !important;
        margin-bottom: 0.5rem;
    }
    
    .action-buttons .btn-group .btn:last-child {
        margin-bottom: 0;
    }
}