/* ========================================
   TOOLS - UNIVERSAL CSS
   Common styles for all tool pages
   ======================================== */

/* Tool Container */
.tool-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.tool-container h1 {
    color: #1976d2;
    margin-bottom: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-container h1 i {
    font-size: 1.2em;
}

/* Tab Navigation */
.nav-tabs {
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 2rem;
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    color: #6c757d;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link.active {
    color: #1976d2;
    border-bottom-color: #1976d2;
    background: none;
}

.nav-tabs .nav-link:hover {
    color: #1976d2;
    border-bottom-color: #1976d2;
}

/* Tab Content */
.tab-content {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
    display: block;
}

.form-control {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    padding: 0.75rem;
    font-size: 1rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #1976d2;
    box-shadow: 0 0 0 0.2rem rgba(25,118,210,0.25);
    outline: 0;
}

.form-control:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #20c997, #17a2b8);
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #138496, #0c7489);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #212529;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e0a800, #d39e00);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333, #bd2130);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Button Groups */
.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

/* File Upload Areas */
.file-upload-area, .image-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
    background: #f8f9fa;
}

.file-upload-area:hover, .image-upload-area:hover,
.file-upload-area.drag-over, .image-upload-area.drag-over {
    border-color: #1976d2;
    background: #e3f2fd;
}

.upload-icon {
    font-size: 2.5rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.upload-text {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.upload-subtext {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Result Areas */
.result-section {
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-top: 2rem;
    border: 1px solid #e9ecef;
}

.result-section h5 {
    color: #495057;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.diff-result, .output-area {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Stats and Info */
.stats-row, .result-stats {
    display: flex;
    justify-content: space-between;
    margin: 1rem 0;
    font-size: 0.875rem;
    color: #6c757d;
    flex-wrap: wrap;
    gap: 1rem;
}

.stat-item {
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-weight: 500;
    font-size: 0.75rem;
}

.stat-item.added {
    background-color: #d4edda;
    color: #155724;
}

.stat-item.removed {
    background-color: #f8d7da;
    color: #721c24;
}

.stat-item.unchanged {
    background-color: #e2e3e5;
    color: #383d41;
}

/* History */
.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 1rem;
    margin: 0.5rem 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    border-color: #1976d2;
    box-shadow: 0 0.125rem 0.25rem rgba(25,118,210,0.15);
}

.history-operation {
    display: inline-block;
    background: #1976d2;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.history-content {
    margin: 0.5rem 0;
}

.history-input, .history-output {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    word-break: break-all;
    margin-bottom: 0.25rem;
}

.history-input {
    color: #1976d2;
}

.history-output {
    color: #28a745;
}

.history-time {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Options and Settings */
.options-section {
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin: 1rem 0;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.3s ease;
}

.option-item:hover {
    background-color: #e9ecef;
}

/* Form Checks */
.form-check {
    margin-bottom: 0.75rem;
}

.form-check-input {
    margin-right: 0.5rem;
}

.form-check-label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 0.375rem;
    color: #fff;
    font-weight: 500;
    z-index: 1050;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

.notification.success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.notification.error {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.notification.warning {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #212529;
}

.notification.info {
    background: linear-gradient(135deg, #17a2b8, #138496);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Alert Boxes */
.alert {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* Diff Styling */
.diff-line {
    display: flex;
    align-items: center;
    padding: 0.25rem 0;
    border-left: 3px solid transparent;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.diff-line.added {
    background-color: #d4edda;
    border-left-color: #28a745;
}

.diff-line.removed {
    background-color: #f8d7da;
    border-left-color: #dc3545;
}

.diff-line.unchanged {
    background-color: transparent;
}

.line-number {
    display: inline-block;
    width: 3rem;
    text-align: right;
    margin-right: 0.5rem;
    color: #6c757d;
    font-size: 0.75rem;
}

.diff-prefix {
    margin-right: 0.5rem;
    font-weight: bold;
}

.diff-content {
    flex: 1;
}

/* No Data States */
.no-history, .no-data {
    text-align: center;
    padding: 3rem 2rem;
    color: #6c757d;
}

.no-history i, .no-data i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Loading States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1976d2;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .tool-container {
        padding: 1rem 0.5rem;
    }
    
    .nav-tabs {
        flex-wrap: wrap;
    }
    
    .nav-tabs .nav-link {
        flex: 1;
        min-width: 80px;
        padding: 0.5rem 0.75rem;
        text-align: center;
    }
    
    .tab-content {
        padding: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        justify-content: center;
        margin-bottom: 0.5rem;
    }
    
    .stats-row, .result-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .file-upload-area, .image-upload-area {
        padding: 1rem;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .tool-container h1 {
        font-size: 1.5rem;
        flex-direction: column;
        text-align: center;
        gap: 0.25rem;
    }
    
    .nav-tabs .nav-link {
        font-size: 0.875rem;
        padding: 0.5rem;
    }
    
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
}

/* Utility Classes */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-flex {
    display: flex !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.align-items-center {
    align-items: center !important;
}

.text-muted {
    color: #6c757d !important;
}

.text-center {
    text-align: center !important;
}

.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }

.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.p-5 { padding: 3rem !important; }
