/**
 * Custom CSS Styles
 */

/* Global Styles */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

footer {
    margin-top: auto;
}

/* Card Styles */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.3s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Form Styles */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.required-field::after {
    content: "*";
    color: var(--danger-color);
    margin-left: 4px;
}

/* CSV Upload Styles */
.upload-area {
    border: 3px dashed #ccc;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
    cursor: pointer;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
    transform: scale(1.01);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.upload-area i {
    font-size: 3.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.upload-area:hover i {
    transform: scale(1.1);
}

#upload-placeholder, #upload-file-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#upload-file-name {
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: bold;
    color: var(--primary-color);
}

#upload-file-info button {
    transition: all 0.3s ease;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
}

#upload-file-info button:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* File input styling */
.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

/* Add focus styles for accessibility */
.file-input:focus + .upload-area,
.file-input:focus-visible + .upload-area {
    outline: 2px solid var(--primary-color);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.25);
}

/* Make sure the file input is accessible */
.file-input:focus {
    outline: none; /* Remove default outline as we're styling the container */
}

/* Position relative container for file input */
.position-relative {
    position: relative;
}

/* CSV Mapping Styles */
.mapping-container {
    max-height: 600px;
    overflow-y: auto;
}

.mapping-row {
    padding: 0.75rem;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
}

.mapping-row:hover {
    background-color: #e9ecef;
}

.mapping-source {
    font-weight: bold;
    color: var(--primary-color);
}

.mapping-target {
    color: var(--success-color);
}

/* CSV Preview Table */
.preview-table {
    width: 100%;
    overflow-x: auto;
}

.preview-table th {
    position: sticky;
    top: 0;
    background-color: #f8f9fa;
    z-index: 10;
}

/* Progress Bar */
.progress {
    height: 2rem;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.progress-bar {
    transition: width 0.3s ease;
    background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
    background-size: 1rem 1rem;
    font-weight: bold;
    font-size: 1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    from { background-position: 1rem 0; }
    to { background-position: 0 0; }
}

#upload-progress-container {
    transition: all 0.3s ease;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    margin-bottom: 1.5rem;
}

#upload-progress-container .form-label {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Drag and Drop */
.draggable {
    cursor: move;
}

.drag-handle {
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

.dropzone {
    min-height: 50px;
    border: 2px dashed #ccc;
    border-radius: 4px;
    margin: 10px 0;
    padding: 10px;
    transition: all 0.3s ease;
}

.dropzone.highlight {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .mapping-row {
        flex-direction: column;
    }
    
    .mapping-row > div {
        margin-bottom: 0.5rem;
    }
}

/* Login/Register Forms */
.auth-form {
    max-width: 400px;
    margin: 2rem auto;
}

.auth-form .card {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.auth-form .card-header {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 1.5rem;
}

.auth-form .card-body {
    padding: 2rem;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Tooltips */
.custom-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.custom-tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
}

.custom-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Error and Success Messages */
.validation-error {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.success-icon {
    color: var(--success-color);
}

.error-icon {
    color: var(--danger-color);
}

.warning-icon {
    color: var(--warning-color);
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-container {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.spinner-text {
    margin-top: 1rem;
    font-weight: bold;
}