/* Advanced Handwriting to Text Converter - Modern CSS */
:root {
    --primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-dark: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    --secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    --warning: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --dark: #1a202c;
    --light: #f7fafc;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border: #e2e8f0;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.tool-page {
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 140px);
}

.tool-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-bottom: 2rem;
}

/* Header Section */
.header-section {
    background: var(--primary);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="25" cy="25" r="2" fill="%23ffffff" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="50" cy="10" r="1.5" fill="%23ffffff" opacity="0.1"/><circle cx="10" cy="60" r="1" fill="%23ffffff" opacity="0.1"/><circle cx="90" cy="40" r="2" fill="%23ffffff" opacity="0.1"/></svg>') repeat;
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-1%, -1%) rotate(90deg); }
    50% { transform: translate(1%, -2%) rotate(180deg); }
    75% { transform: translate(-2%, 1%) rotate(270deg); }
}

.header-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.header-section h1 i {
    margin-right: 0.5rem;
    color: #f093fb;
}

.tool-description {
    position: relative;
    z-index: 1;
}

.tool-description p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.feature-item {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.feature-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.feature-item i {
    font-size: 1.25rem;
    color: #f093fb;
}

/* Tool Interface */
.tool-interface {
    padding: 2rem;
}

/* Upload Section */
.upload-section {
    margin-bottom: 2rem;
}

.upload-area {
    border: 3px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem;
    text-align: center;
    transition: var(--transition);
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: var(--transition);
}

.upload-area:hover::before {
    left: 100%;
}

.upload-area.dragover {
    border-color: #667eea;
    background: linear-gradient(145deg, #e0e7ff, #ddd6fe);
    transform: scale(1.02);
}

.upload-content {
    position: relative;
    z-index: 1;
}

.upload-icon {
    font-size: 4rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    background: var(--primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.upload-area h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.upload-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow);
}

.upload-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.supported-formats {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(102, 126, 234, 0.1);
    border-radius: var(--radius);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.supported-formats p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* File Preview */
.file-preview {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid #667eea;
}

.preview-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.preview-item:last-child {
    margin-bottom: 0;
}

.preview-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    object-fit: cover;
    box-shadow: var(--shadow);
}

.preview-info {
    flex: 1;
}

.preview-info h4 {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.preview-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

/* Processing Options */
.processing-options {
    background: #f8fafc;
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-header h3 i {
    color: #667eea;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.option-group label i {
    color: #667eea;
    width: 16px;
}

.modern-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: white;
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
    cursor: pointer;
}

.modern-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.advanced-options {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.checkbox-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.checkbox-group:hover {
    background: #e2e8f0;
    border-color: #667eea;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.checkbox-group span {
    font-weight: 500;
    color: var(--text-primary);
}

/* Process Button */
.process-button-section {
    text-align: center;
    margin-top: 2rem;
}

/* Progress Section */
.progress-section {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.progress-header h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.progress-status {
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-container {
    position: relative;
    margin-bottom: 2rem;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 6px;
    width: 0%;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progress-shimmer 1.5s infinite;
}

@keyframes progress-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-size: 0.875rem;
}

.processing-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius);
    transition: var(--transition);
    opacity: 0.6;
}

.step.active {
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid #667eea;
    opacity: 1;
    transform: scale(1.02);
}

.step.completed {
    background: rgba(34, 197, 94, 0.1);
    border: 2px solid #22c55e;
    opacity: 1;
}

.step i {
    color: #667eea;
    width: 20px;
}

.step.completed i {
    color: #22c55e;
}

/* Results Section */
.results-section {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.accuracy-score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(34, 197, 94, 0.1);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid #22c55e;
}

.score-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.score-value {
    font-weight: 700;
    color: #22c55e;
    font-size: 1.125rem;
}

.text-output-container {
    margin: 2rem 0;
}

.output-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: var(--radius);
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active {
    background: white;
    color: var(--text-primary);
    box-shadow: var(--shadow);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.text-output {
    width: 100%;
    min-height: 200px;
    padding: 1.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    background: #fafafa;
    color: var(--text-primary);
    resize: vertical;
    transition: var(--transition);
}

.text-output:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

.text-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border);
}

.tool-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-item i {
    color: #667eea;
    width: 16px;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 0.95rem;
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-outline {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-outline:hover {
    border-color: #667eea;
    color: #667eea;
}

.reset-btn {
    margin-top: 2rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Info Section */
.info-section {
    margin-top: 4rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.info-card {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
    border-top: 4px solid transparent;
}

.info-card:nth-child(1) { border-top-color: #667eea; }
.info-card:nth-child(2) { border-top-color: #22c55e; }
.info-card:nth-child(3) { border-top-color: #f59e0b; }
.info-card:nth-child(4) { border-top-color: #ef4444; }

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary);
    margin-bottom: 1rem;
}

.card-icon i {
    font-size: 1.5rem;
    color: white;
}

.info-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.info-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: auto;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    padding: 0.5rem;
    border-radius: 50%;
}

.modal-close:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.translation-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.language-selectors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.language-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.language-group label {
    font-weight: 500;
    color: var(--text-primary);
}

.language-group select {
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: white;
    color: var(--text-primary);
    cursor: pointer;
}

.translation-output {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: #fafafa;
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Notification */
.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1100;
    transform: translateX(100%);
    transition: var(--transition);
}

.notification.show {
    transform: translateX(0);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid #22c55e;
    min-width: 300px;
}

.notification.error .notification-content {
    border-left-color: #ef4444;
}

.notification.warning .notification-content {
    border-left-color: #f59e0b;
}

.notification-icon {
    font-size: 1.25rem;
    color: #22c55e;
}

.notification.error .notification-icon {
    color: #ef4444;
}

.notification.warning .notification-icon {
    color: #f59e0b;
}

.notification-message {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition);
}

.notification-close:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .tool-page {
        padding: 1rem;
    }
    
    .header-section {
        padding: 2rem 1rem;
    }
    
    .header-section h1 {
        font-size: 2rem;
    }
    
    .tool-interface {
        padding: 1rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .checkbox-options {
        grid-template-columns: 1fr;
    }
    
    .tool-stats {
        gap: 1rem;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        justify-content: center;
    }
    
    .language-selectors {
        grid-template-columns: 1fr;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .notification {
        left: 1rem;
        right: 1rem;
        top: 1rem;
        transform: translateY(-100%);
    }
    
    .notification.show {
        transform: translateY(0);
    }
    
    .notification-content {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .header-section h1 {
        font-size: 1.75rem;
    }
    
    .tool-description p {
        font-size: 1rem;
    }
    
    .upload-area {
        padding: 1.5rem 1rem;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .processing-options,
    .progress-section,
    .results-section {
        padding: 1rem;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .tool-page {
        background: white;
    }
    
    .header-section,
    .upload-section,
    .processing-options,
    .progress-section,
    .action-buttons,
    .info-section {
        display: none;
    }
    
    .results-section {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
    
    .text-output {
        border: 1px solid #ccc;
        background: white;
        font-family: 'Times New Roman', serif;
    }
}
