/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: relative;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.logo i {
    font-size: 1.5rem;
    color: #667eea;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 0.9rem;
    color: #666;
    font-weight: 400;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Upload Section */
.upload-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    margin-bottom: 2rem;
}

.upload-container {
    max-width: 800px;
    margin: 0 auto;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 16px;
    padding: 3rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(102, 126, 234, 0.05);
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: #764ba2;
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #764ba2;
    background: rgba(102, 126, 234, 0.15);
    transform: scale(1.02);
}

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

.upload-icon i {
    font-size: 4rem;
    color: #667eea;
    margin-bottom: 1.5rem;
}

.upload-area h3 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.75rem;
}

.upload-area p {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.supported-formats {
    display: inline-block;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 1.5rem;
}

.upload-info {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 10px;
}

.file-preview {
    margin-bottom: 1rem;
}

.file-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.file-details h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.file-details p {
    color: #666;
    font-size: 0.9rem;
}

/* Tools Section */
.tools-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.tools-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.tools-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.75rem;
}

.tools-header p {
    color: #666;
    font-size: 1.1rem;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    justify-content: center;
}

.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: rgba(102, 126, 234, 0.1);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 500;
    color: #667eea;
    position: relative;
}

.tab-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: #667eea;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.tab-btn.completed {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
}

.tab-btn.completed::after {
    content: '✓';
    position: absolute;
    top: -5px;
    right: -5px;
    background: #4caf50;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
}

.tab-btn.current {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    animation: pulse 2s infinite;
}

.tab-btn.current::after {
    content: '●';
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ffc107;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    animation: pulse 2s infinite;
}

.tab-btn.pending {
    background: rgba(158, 158, 158, 0.1);
    color: #9e9e9e;
}

.tab-btn i {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

/* Tab Content */
.tab-content-wrapper {
    position: relative;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* Tool Headers */
.tool-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.tool-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tool-header h3 i {
    color: #667eea;
}

.tool-header p {
    color: #666;
    font-size: 0.9rem;
}

/* Live Preview */
.live-preview {
    background: rgba(102, 126, 234, 0.05);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.live-preview h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.live-preview h4 i {
    color: #667eea;
}

.live-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Crop Container */
.crop-container {
    position: relative;
    margin-bottom: 1.5rem;
    border-radius: 10px;
    overflow: hidden;
}

.crop-area {
    position: relative;
    display: inline-block;
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.crop-area img {
    display: block;
    max-width: 100%;
    height: auto;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: crosshair;
}

.crop-box {
    position: absolute;
    border: 3px solid #667eea;
    background: rgba(102, 126, 234, 0.1);
    cursor: move;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.4);
    touch-action: none;
}

.crop-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #667eea;
    border: 3px solid white;
    border-radius: 50%;
    cursor: pointer;
    touch-action: none;
}

.crop-handle.top-left { top: -6px; left: -6px; }
.crop-handle.top-right { top: -6px; right: -6px; }
.crop-handle.bottom-left { bottom: -6px; left: -6px; }
.crop-handle.bottom-right { bottom: -6px; right: -6px; }

/* Controls */
.crop-controls, .resize-controls, .convert-controls {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-item label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.control-item span {
    font-size: 0.8rem;
    color: #666;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group label i {
    color: #667eea;
}

.control-group input[type="number"],
.control-group input[type="text"],
.control-group select {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
    background: white;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.control-group .value {
    display: inline-block;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    min-width: 40px;
    text-align: center;
}

/* Checkboxes */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.3s ease;
    font-size: 0.9rem;
}

.checkbox-label:hover {
    background: rgba(102, 126, 234, 0.05);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
    background: white;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #667eea;
    border-color: #667eea;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
}

/* Filters Grid */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 48px;
    min-width: 48px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-secondary {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

#uploadNewBtn {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s;
    margin-top: 10px;
}

#uploadNewBtn:hover {
    background: #138496;
}

#uploadNewBtn i {
    margin-right: 0.5rem;
}

.btn-success {
    background: #4caf50;
    color: white;
}

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

/* Results Section */
.results-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    margin-top: 1.5rem;
}

.results-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.results-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.results-header h2 i {
    color: #667eea;
}

.results-header p {
    color: #666;
    font-size: 0.9rem;
}

.result-container {
    text-align: center;
}

.result-image {
    margin-bottom: 1rem;
}

.result-image img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.result-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Loading Overlay */
.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;
    backdrop-filter: blur(5px);
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    font-size: 1rem;
    font-weight: 500;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .main-content {
        padding: 0.75rem;
    }
    
    .upload-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .tools-section {
        padding: 1rem;
    }
    
    .tab-navigation {
        gap: 0.25rem;
        padding: 0 0.5rem;
    }
    
    .tab-btn {
        padding: 0.5rem 0.75rem;
        min-width: 70px;
        font-size: 0.75rem;
    }
    
    .crop-container {
        margin-bottom: 1rem;
    }
    
    .crop-controls, .resize-controls, .convert-controls {
        padding: 0.75rem;
    }
    
    .control-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .filters-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.5rem;
    }
    
    .quick-filters {
        gap: 0.25rem;
    }
    
    .action-buttons {
        gap: 0.5rem;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        min-height: 48px;
        min-width: 48px;
    }
    
    .results-section {
        padding: 1rem;
        margin-top: 1rem;
    }
    
    .result-actions {
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .logo {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .logo h1 {
        font-size: 1.3rem;
    }
    
    .upload-area {
        padding: 1.5rem 1rem;
    }
    
    .upload-icon i {
        font-size: 2.5rem;
    }
    
    .upload-area h3 {
        font-size: 1.1rem;
    }
    
    .tools-header h2 {
        font-size: 1.3rem;
    }
    
    .tool-header h3 {
        font-size: 1.1rem;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .tab-btn {
        padding: 0.5rem;
        min-width: 60px;
        font-size: 0.7rem;
    }
    
    .tab-btn i {
        font-size: 1rem;
    }
    
    .control-group input[type="number"],
    .control-group input[type="text"],
    .control-group select {
        padding: 0.75rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
        min-height: 48px;
        min-width: 48px;
    }
    
    .live-preview img {
        max-height: 250px;
    }
    
    .result-image img {
        max-height: 300px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 48px;
        min-width: 48px;
    }
    
    .tab-btn {
        min-height: 48px;
        min-width: 48px;
    }
    
    .control-group input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    
    .control-group input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
    
    .crop-handle {
        width: 24px;
        height: 24px;
    }
    
    .crop-box {
        border-width: 4px;
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
    }
}

/* Accessibility improvements */
* {
    -webkit-tap-highlight-color: transparent;
}

button:focus,
input:focus,
select:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

/* Notification Container */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    width: calc(100vw - 40px);
}

.notification {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
    border-left: 4px solid #667eea;
}

.notification.success {
    border-left-color: #4caf50;
}

.notification.error {
    border-left-color: #f44336;
}

.notification.warning {
    border-left-color: #ff9800;
}

.notification.info {
    border-left-color: #2196f3;
}

.notification-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
}

.notification.success .notification-icon {
    background: #4caf50;
}

.notification.error .notification-icon {
    background: #f44336;
}

.notification.warning .notification-icon {
    background: #ff9800;
}

.notification.info .notification-icon {
    background: #2196f3;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.notification-message {
    color: #666;
    font-size: 0.85rem;
    line-height: 1.4;
}

.notification-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    line-height: 1;
}

.notification-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #666;
}

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

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

.notification.removing {
    animation: slideOut 0.3s ease forwards;
}

/* Mobile notification adjustments */
@media (max-width: 768px) {
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        width: auto;
    }
    
    .notification {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .notification-title {
        font-size: 0.85rem;
    }
    
    .notification-message {
        font-size: 0.8rem;
    }
}

 