/* Images to PDF - Premium Responsive Styles with Day/Night Support */

/* Base Container */
.img2pdf-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.img2pdf-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

/* Title Section */
.img2pdf-title {
    font-size: 3rem;
    font-weight: 800;
    font-family: 'Poppins', sans-serif;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text);
    letter-spacing: -0.02em;
}

.img2pdf-heart {
    font-size: 2.8rem;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.img2pdf-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    font-family: 'Poppins', sans-serif;
}

/* Main Card */
.img2pdf-card {
    background: var(--surface);
    border-radius: var(--radius);
    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;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg);
    padding: 3rem 2rem;
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--surface);
}

.upload-content {
    text-align: center;
}

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

.upload-content h3 {
    color: var(--text);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.upload-content p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.upload-button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.upload-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

/* Editor Section */
.editor-section {
    animation: fadeIn 0.3s ease;
}

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

/* Toolbar */
.toolbar {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.global-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.global-options label {
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 500;
}

.global-options select,
.global-options input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
}

.global-options select:focus,
.global-options input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Images Grid */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.2rem;
    margin: 1.5rem 0;
    max-height: 500px;
    overflow-y: auto;
    padding: 0.5rem;
}

/* Custom Scrollbar for Grid */
.images-grid::-webkit-scrollbar {
    width: 8px;
}

.images-grid::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 10px;
}

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

/* Image Item */
.image-item {
    position: relative;
    border: 2px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg);
    transition: all 0.3s ease;
    cursor: grab;
}

.image-item:active {
    cursor: grabbing;
}

.image-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.image-item:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px var(--shadow-color);
}

.image-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

/* Image Controls */
.image-controls {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px;
    border-radius: 10px;
    backdrop-filter: blur(4px);
}

.image-controls button {
    width: 30px;
    height: 30px;
    background: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-controls button:hover {
    transform: scale(1.05);
    background: var(--primary);
    color: white;
}

.image-controls button:active {
    transform: scale(0.95);
}

/* Delete Button Specific */
.image-controls button:last-child:hover {
    background: #ef4444;
    color: white;
}

/* Image Order Indicator */
.image-order {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

/* Action Buttons */
.img2pdf-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.img2pdf-action-btn {
    flex: 1;
    min-width: 140px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.9rem 1.4rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

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

.generate-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: #6366f1;
    color: white;
}

.generate-btn:hover {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.secondary {
    background: transparent;
}

/* Tips Section */
.img2pdf-tips {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.img2pdf-tips h3 {
    color: var(--text);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.img2pdf-tips ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.img2pdf-tips li {
    color: var(--text-light);
    font-size: 0.9rem;
    padding-left: 1.5rem;
    position: relative;
}

.img2pdf-tips li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

/* Loading State */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    flex-direction: column;
    gap: 1rem;
}

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

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

.loading-text {
    color: white;
    font-size: 1rem;
}

/* Message Notifications */
.img2pdf-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    animation: slideInRight 0.3s ease;
    z-index: 1000;
    font-size: 0.9rem;
    box-shadow: 0 10px 20px var(--shadow-color);
}

.img2pdf-message-success {
    background: #10b981;
    color: white;
}

.img2pdf-message-error {
    background: #ef4444;
    color: white;
}

.img2pdf-message-info {
    background: var(--primary);
    color: white;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .img2pdf-container {
        padding: 0 1rem;
    }
    
    .img2pdf-title {
        font-size: 2rem;
    }
    
    .img2pdf-heart {
        font-size: 2rem;
    }
    
    .img2pdf-card {
        padding: 1.2rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .upload-content h3 {
        font-size: 1rem;
    }
    
    .upload-content p {
        font-size: 0.8rem;
    }
    
    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 1rem;
    }
    
    .image-item img {
        height: 140px;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .global-options {
        justify-content: space-between;
    }
    
    .global-options select,
    .global-options input {
        flex: 1;
    }
    
    .img2pdf-actions {
        flex-direction: column;
    }
    
    .img2pdf-action-btn {
        width: 100%;
    }
    
    .img2pdf-tips ul {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .image-controls button {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .img2pdf-title {
        font-size: 1.5rem;
    }
    
    .img2pdf-subtitle {
        font-size: 0.85rem;
    }
    
    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.8rem;
    }
    
    .image-item img {
        height: 120px;
    }
    
    .image-controls {
        top: 5px;
        right: 5px;
        gap: 4px;
    }
    
    .image-controls button {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    .image-order {
        font-size: 0.6rem;
        padding: 2px 6px;
    }
    
    .global-options {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
    }
    
    .global-options label {
        display: inline-block;
        width: auto;
    }
    
    .img2pdf-message {
        left: 10px;
        right: 10px;
        text-align: center;
        font-size: 0.8rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .image-item {
        cursor: pointer;
    }
    
    .image-controls button {
        min-width: 34px;
        min-height: 34px;
    }
    
    .upload-button,
    .img2pdf-action-btn {
        padding: 0.8rem 1rem;
    }
}

/* Print Styles */
@media print {
    .upload-area,
    .toolbar,
    .img2pdf-actions,
    .image-controls,
    .img2pdf-tips,
    .imagesplit-related {
        display: none;
    }
    
    .editor-section {
        display: block !important;
    }
    
    .image-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Dark Mode Specific Adjustments */
.dark-mode .image-controls {
    background: rgba(0, 0, 0, 0.8);
}

.dark-mode .image-controls button {
    background: #2d2d44;
    color: white;
}

.dark-mode .image-controls button:hover {
    background: var(--primary);
}

/* Smooth Transitions */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
}