/* HTML Formatter Tool Styles */

/* Main Container */
.html-formatter-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
    margin-bottom: 40px;
}

/* Tool Header */
.tool-header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.tool-header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #fff, #e3f2fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tool-header p {
    font-size: 1.2rem;
    margin-bottom: 0;
    opacity: 0.9;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Format Mode Selector */
.format-mode-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 12px 24px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    color: white;
    text-decoration: none;
}

.mode-btn.active {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    border-color: #4CAF50;
    box-shadow: 0 8px 16px rgba(76, 175, 80, 0.4);
}

.mode-btn .btn-icon {
    font-size: 1.2rem;
}

/* Main Content Area */
.main-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Format Mode Content */
.format-mode-content {
    display: none;
}

.format-mode-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.section-header h3 {
    margin: 0;
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.5rem;
}

.section-actions {
    display: flex;
    gap: 10px;
}

/* Editor Layout */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .editor-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.input-section,
.output-section {
    display: flex;
    flex-direction: column;
}

/* Form Elements */
.form-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1rem;
}

.html-textarea {
    width: 100%;
    min-height: 300px;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.html-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

.html-textarea::placeholder {
    color: #6c757d;
    font-style: italic;
}

/* Formatting Options */
.formatting-options {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.formatting-options h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-group label {
    font-weight: 500;
    color: #495057;
    font-size: 0.9rem;
}

.form-select,
.form-range {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.form-select:focus,
.form-range:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.checkbox-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.checkbox-label:hover {
    background-color: rgba(102, 126, 234, 0.05);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

/* Format Controls */
.format-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.validate-controls,
.minify-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid #6c757d;
    color: #6c757d;
}

.btn-outline:hover {
    background: #6c757d;
    color: white;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-icon {
    font-size: 1.1rem;
}

/* Validation Results */
.validation-results {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.validation-results h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1.3rem;
}

.validation-summary {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 500;
}

.validation-summary.valid {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.validation-summary.invalid {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.validation-details {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.validation-error,
.validation-warning {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
}

.validation-error {
    background: #fff5f5;
    border-left: 4px solid #dc3545;
}

.validation-warning {
    background: #fffdf5;
    border-left: 4px solid #ffc107;
}

/* Minify Options */
.minify-options {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.minify-options h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Batch Processing */
.batch-section {
    text-align: center;
}

.upload-area {
    border: 3px dashed #dee2e6;
    border-radius: 15px;
    padding: 40px 20px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.upload-area.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    color: #6c757d;
}

.upload-area h4 {
    margin-bottom: 10px;
    color: #2c3e50;
}

.upload-area p {
    color: #6c757d;
    margin-bottom: 20px;
}

.batch-progress {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #dee2e6;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.progress-text {
    font-weight: 500;
    color: #2c3e50;
}

.progress-percent {
    font-weight: 600;
    color: #667eea;
}

.progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-steps {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #6c757d;
}

.batch-results {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #dee2e6;
    text-align: left;
}

.batch-results h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
}

.batch-files-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.batch-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 8px;
}

.file-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.file-name {
    font-weight: 500;
    color: #2c3e50;
}

.file-details {
    font-size: 0.9rem;
    color: #6c757d;
}

.file-actions {
    display: flex;
    gap: 8px;
}

.batch-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* Preview Modal */
.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.modal-body {
    flex-grow: 1;
    padding: 0;
    overflow: hidden;
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    min-height: 400px;
}

/* Progress Section */
.progress-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #dee2e6;
    text-align: center;
}

/* History Section */
.history-section {
    background: #f8f9fa;
    border-radius: 20px;
    padding: 30px;
    margin: 40px 0;
    border: 1px solid #e9ecef;
}

.history-section h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
}

.history-controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 20px;
}

.history-list {
    background: white;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.history-item:hover {
    background: #f8f9fa;
}

.history-item:last-child {
    border-bottom: none;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.history-date {
    font-size: 0.9rem;
    color: #6c757d;
}

.history-type {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    background: #e9ecef;
    color: #495057;
}

.history-preview {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    color: #6c757d;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.no-history {
    text-align: center;
    color: #6c757d;
    padding: 40px;
    font-style: italic;
}

/* Tool Info */
.tool-info {
    background: #f8f9fa;
    border-radius: 20px;
    padding: 30px;
    margin: 40px 0;
    border: 1px solid #e9ecef;
}

.info-section h3 {
    margin: 0 0 25px 0;
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 600;
    text-align: center;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.feature-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.feature-item h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 1.2rem;
    font-weight: 600;
}

.feature-item p {
    margin: 0;
    color: #6c757d;
    line-height: 1.5;
}

.info-section h4 {
    margin: 30px 0 15px 0;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
}

.info-section ol {
    padding-left: 20px;
}

.info-section li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.info-section li strong {
    color: #2c3e50;
}

/* Stats Display */
.stats-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.stat-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #e9ecef;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #667eea;
    display: block;
}

.stat-label {
    font-size: 0.9rem;
    color: #6c757d;
    margin-top: 5px;
}

/* Error Messages */
.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.success-message {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .html-formatter-container {
        padding: 20px 15px;
        margin-bottom: 20px;
    }
    
    .tool-header h1 {
        font-size: 2rem;
    }
    
    .tool-header p {
        font-size: 1rem;
    }
    
    .format-mode-selector {
        gap: 10px;
    }
    
    .mode-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .checkbox-options {
        grid-template-columns: 1fr;
    }
    
    .format-controls,
    .validate-controls,
    .minify-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-display {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .history-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .batch-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .modal-content {
        margin: 10px;
        max-height: 95vh;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
    
    .upload-icon {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .tool-header h1 {
        font-size: 1.8rem;
    }
    
    .mode-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
        gap: 4px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .html-textarea {
        min-height: 200px;
        font-size: 13px;
    }
    
    .stats-display {
        grid-template-columns: 1fr;
    }
    
    .tool-info,
    .history-section {
        padding: 20px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .main-content {
        background: #1e1e1e;
        color: #e0e0e0;
    }
    
    .html-textarea {
        background: #2d2d2d;
        color: #e0e0e0;
        border-color: #404040;
    }
    
    .html-textarea:focus {
        border-color: #667eea;
        background: #2d2d2d;
    }
    
    .formatting-options,
    .minify-options,
    .batch-progress,
    .batch-results {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .form-label,
    .section-header h3 {
        color: #e0e0e0;
    }
    
    .upload-area {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .batch-file-item {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .history-section,
    .tool-info {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .feature-item {
        background: #1e1e1e;
        border-color: #404040;
    }
}
