/* Image Splitter - Fully Responsive Layout */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

.imagesplit-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    font-family: 'Poppins', sans-serif;
}

.imagesplit-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

.imagesplit-title {
    font-size: 3rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.imagesplit-icon {
    font-size: 2.8rem;
    display: inline-block;
    animation: cut 2s ease-in-out infinite;
}

@keyframes cut {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(15deg); }
}

.imagesplit-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.imagesplit-card {
    background: var(--surface);
    border-radius: var(--radius, 20px);
    border: 1px solid var(--border);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

/* Upload Area */
.upload-area {
    border: 3px dashed var(--border);
    border-radius: 20px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.upload-btn {
    margin-top: 1.5rem;
    padding: 0.8rem 2rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Split Options */
.split-options {
    margin-top: 1rem;
}

/* Mode Tabs - Full Width */
.split-mode-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
}

.split-mode-tab {
    background: transparent;
    border: none;
    color: var(--text-light);
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.split-mode-tab:hover {
    color: var(--primary);
}

.split-mode-tab.active {
    background: var(--primary);
    color: white;
}

.split-mode {
    display: none;
}

.split-mode.active {
    display: block;
}

/* Control Panel - Full Width */
.split-control-panel {
    background: var(--bg);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}

.split-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.control-group {
    flex: 1;
    min-width: 150px;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 500;
}

.number-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.number-input input {
    width: 80px;
    padding: 0.5rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.number-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.number-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin-top: 1.5rem;
}

.checkbox-label input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.checkbox-label span {
    font-size: 0.85rem;
    color: var(--text-light);
}

.split-action {
    margin-top: 1rem;
    text-align: center;
}

.split-btn {
    padding: 0.8rem 2rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.split-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Two Columns Layout */
.split-two-columns {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Left Column - Uploaded Image Preview */
.split-preview-column {
    flex: 1;
    background: var(--bg);
    border-radius: 16px;
    padding: 1.2rem;
    border: 1px solid var(--border);
}

.column-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

.column-icon {
    font-size: 1.3rem;
}

.column-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.preview-container {
    background: var(--bg);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 250px;
    position: relative;
}

.uploaded-preview {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

.grid-overlay-canvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.preview-info {
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.preview-info span {
    font-size: 0.85rem;
    color: var(--text-light);
}

.change-image-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.change-image-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Right Column - Split Results */
.split-results-column {
    flex: 1;
    background: var(--bg);
    border-radius: 16px;
    padding: 1.2rem;
    border: 1px solid var(--border);
}

/* Results Area */
.results-area {
    margin-top: 0.5rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.results-header span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary);
}

.results-grid {
    max-height: auto;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Pieces Grid */
.pieces-grid {
    display: grid;
    gap: 2px;
}

.horizontal-strips {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vertical-strips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.vertical-strips {
    min-width: 120px;
}

/* ====================== PIECE CARD STYLES - CLEAN VERSION ====================== */

.piece-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s;
    position: relative;
    cursor: pointer;
}

.piece-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.piece-card img {
    width: 100%;
    height: auto;
    display: block;
}

/* Clean piece info - no background, minimal styling */
.piece-info {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    z-index: 2;
}

/* Download icon button - clean and minimal */
.download-piece {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.9);
}

.piece-card:hover .download-piece {
    opacity: 1;
    transform: scale(1);
}

.download-piece:hover {
    background: var(--primary);
    transform: scale(1.05);
}

/* Piece number - minimal overlay on hover */
.piece-number {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
}

.piece-card:hover .piece-number {
    opacity: 1;
}

/* Hidden elements */
.piece-size {
    display: none;
}

/* For vertical strips layout */
.vertical-strips .piece-card {
    min-width: 120px;
}

.horizontal-strips .piece-card {
    width: 100%;
}

/* No Results Message */
.no-results-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    background: var(--surface);
    border-radius: 12px;
    border: 2px dashed var(--border);
    color: var(--text-light);
}

.no-results-message span {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.no-results-message p {
    font-size: 0.85rem;
    margin: 0;
}

/* Download Buttons Section */
.download-buttons-section {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.download-btn {
    padding: 0.8rem 2rem;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.reset-btn {
    padding: 0.8rem 2rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
}

.reset-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Presets */
.imagesplit-presets {
    margin: 2rem 0;
    text-align: center;
}

.imagesplit-presets h3 {
    color: var(--text);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
}

.preset-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-light);
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.preset-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* Tips Section */
.imagesplit-tips {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(143, 109, 255, 0.1));
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin: 1.5rem 0;
    text-align: center;
}

.imagesplit-tips h3 {
    color: var(--text);
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.imagesplit-tips p {
    color: var(--text-light);
    font-size: 0.85rem;
    margin: 0;
}

/* SEO Section */
.imagesplit-seo {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.imagesplit-seo h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.imagesplit-seo h3 {
    font-size: 1.1rem;
    margin: 1rem 0 0.5rem;
    color: var(--text);
}

.imagesplit-seo p {
    color: var(--text-light);
    line-height: 1.6;
    font-size: 0.9rem;
}

.imagesplit-howto-list {
    padding-left: 1.2rem;
    margin: 0.5rem 0;
}

.imagesplit-howto-list li {
    color: var(--text-light);
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
}

/* Messages */
.split-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.85rem;
    animation: slideIn 0.3s ease;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.split-message-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.split-message-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.split-message-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

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

/* ====================== RESPONSIVE DESIGN ====================== */

/* Desktop - Side by Side */
@media screen and (min-width: 768px) {
    .split-two-columns {
        flex-direction: row;
    }
}

/* Mobile - Stack Vertically */
@media screen and (max-width: 767px) {
    .imagesplit-container {
        padding: 0 1rem;
    }
    
    .imagesplit-title {
        font-size: 2rem;
    }
    
    .imagesplit-icon {
        font-size: 1.8rem;
    }
    
    .imagesplit-card {
        padding: 1rem;
    }
    
    .split-two-columns {
        flex-direction: column;
        gap: 1rem;
    }
    
    .split-preview-column,
    .split-results-column {
        width: 100%;
    }
    
    .split-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .control-group {
        width: 100%;
    }
    
    .download-buttons-section {
        flex-direction: column;
    }
    
    .download-btn,
    .reset-btn {
        width: 100%;
        text-align: center;
    }
    
    .vertical-strips {
        flex-direction: column;
    }
    
    .vertical-strips .piece-card {
        min-width: auto;
    }
    
    .preview-info {
        flex-direction: column;
        text-align: center;
    }
}

/* Tablet */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .split-controls {
        flex-wrap: wrap;
    }
    
    .control-group {
        min-width: 180px;
    }
}

/* Scrollbar */
.results-grid::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.results-grid::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 3px;
}

.results-grid::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

