/**
 * upload_handler.css - Styles for Upload Handler Modals
 * 
 * Provides consistent styling for admin password prompts and confirmation dialogs
 * Matches the existing login system and multi-view UI design patterns
 */

/* Base modal overlay */
.upload-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: uploadFadeIn 0.2s ease-out;
}

/* Fade in animation */
@keyframes uploadFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal content container */
.upload-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    min-width: 300px;
    max-width: 90vw;
    max-height: 90vh;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
    animation: uploadSlideIn 0.3s ease-out;
    overflow-y: auto;
}

/* Wide modal for longer content */
.upload-modal-wide {
    min-width: 500px;
    max-width: 600px;
}

/* Slide in animation */
@keyframes uploadSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal title */
.upload-modal-title {
    margin: 0 0 1rem 0;
    color: #333;
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
}

/* Modal text */
.upload-modal-text {
    margin: 0 0 1rem 0;
    color: #666;
    line-height: 1.5;
    font-size: 0.95rem;
}

/* Pre-formatted message (for script execution confirmation) */
.upload-modal-message {
    white-space: pre-wrap;
    margin: 0 0 1.5rem 0;
    color: #555;
    font-family: system-ui, sans-serif;
    font-size: 0.9rem;
    line-height: 1.4;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    border-left: 4px solid #2563eb;
    max-height: 300px;
    overflow-y: auto;
}

/* Form group */
.upload-form-group {
    margin-bottom: 1rem;
}

/* Input styling */
.upload-input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.upload-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.upload-input::placeholder {
    color: #999;
}

/* Button group */
.upload-button-group {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Base button styling */
.upload-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: inherit;
    min-width: 80px;
}

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

.upload-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Primary button (blue) */
.upload-btn-primary {
    background: #2563eb;
    color: white;
}

.upload-btn-primary:hover {
    background: #1d4ed8;
}

.upload-btn-primary:active {
    background: #1e40af;
}

/* Secondary button (gray) */
.upload-btn-secondary {
    background: #f5f5f5;
    color: #374151;
    border: 1px solid #d1d5db;
}

.upload-btn-secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.upload-btn-secondary:active {
    background: #d1d5db;
}

/* Danger button (red) */
.upload-btn-danger {
    background: #dc2626;
    color: white;
}

.upload-btn-danger:hover {
    background: #b91c1c;
}

.upload-btn-danger:active {
    background: #991b1b;
}

/* Success button (green) */
.upload-btn-success {
    background: #10b981;
    color: white;
}

.upload-btn-success:hover {
    background: #059669;
}

.upload-btn-success:active {
    background: #047857;
}

/* Chinese text support */
.upload-modal-content.chinese-text {
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Source Han Sans CN", sans-serif;
    font-feature-settings: "kern" 1;
    text-rendering: optimizeLegibility;
}

.upload-modal-content.chinese-text .upload-modal-title {
    font-weight: 500;
    letter-spacing: 0.02em;
}

.upload-modal-content.chinese-text .upload-btn {
    letter-spacing: 0.05em;
}

/* Responsive design */
@media (max-width: 768px) {
    .upload-modal-content {
        padding: 1.5rem;
        margin: 1rem;
        min-width: 0;
        width: calc(100vw - 2rem);
    }
    
    .upload-modal-wide {
        min-width: 0;
        max-width: none;
    }
    
    .upload-button-group {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .upload-btn {
        width: 100%;
        padding: 0.8rem 1rem;
    }
    
    .upload-modal-message {
        font-size: 0.85rem;
        padding: 0.8rem;
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .upload-modal-content {
        padding: 1rem;
        margin: 0.5rem;
        width: calc(100vw - 1rem);
    }
    
    .upload-modal-title {
        font-size: 1.1rem;
    }
    
    .upload-modal-text,
    .upload-input,
    .upload-btn {
        font-size: 0.9rem;
    }
}

/* Modal title with status colors */
.upload-title-success {
    color: #10b981;
}

.upload-title-error {
    color: #dc2626;
}

/* Execution log container */
.upload-execution-log-container {
    margin: 1rem 0 1.5rem 0;
}

.upload-log-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

/* Execution log textarea */
.upload-execution-log {
    width: 100%;
    min-height: 300px;
    max-height: 400px;
    padding: 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    background: #f8f9fa;
    color: #1f2937;
    resize: vertical;
    box-sizing: border-box;
    white-space: pre;
    overflow-wrap: normal;
    word-break: normal;
}

.upload-execution-log:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Toast message for brief notifications */
.upload-toast-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: 6px;
    z-index: 10001;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
}

.upload-toast-message.show {
    opacity: 1;
    transform: translateY(0);
}

/* Dark mode support for new elements */
@media (prefers-color-scheme: dark) {
    .upload-log-label {
        color: #d1d5db;
    }
    
    .upload-execution-log {
        background: #111827;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .upload-execution-log:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    }
    
    .upload-title-success {
        color: #34d399;
    }
    
    .upload-title-error {
        color: #f87171;
    }
}

/* High contrast mode support for new elements */
@media (prefers-contrast: high) {
    .upload-execution-log {
        border: 2px solid #333;
    }
    
    .upload-execution-log:focus {
        border-color: #000;
        box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2);
    }
}

/* Responsive design for execution log */
@media (max-width: 768px) {
    .upload-execution-log {
        min-height: 200px;
        max-height: 250px;
        font-size: 0.8rem;
        padding: 0.6rem;
    }
    
    .upload-toast-message {
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .upload-execution-log {
        min-height: 150px;
        max-height: 200px;
        font-size: 0.75rem;
    }
}
@media (prefers-contrast: high) {
    .upload-modal-content {
        border: 2px solid #000;
    }
    
    .upload-input {
        border: 2px solid #333;
    }
    
    .upload-input:focus {
        border-color: #000;
        box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.2);
    }
    
    .upload-btn {
        border: 2px solid;
    }
    
    .upload-btn-primary {
        border-color: #1e40af;
    }
    
    .upload-btn-secondary {
        border-color: #374151;
    }
    
    .upload-btn-danger {
        border-color: #991b1b;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .upload-modal-overlay,
    .upload-modal-content,
    .upload-btn,
    .upload-input {
        animation: none;
        transition: none;
    }
    
    .upload-btn:hover {
        transform: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .upload-modal-content {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .upload-modal-title {
        color: #f9fafb;
    }
    
    .upload-modal-text {
        color: #d1d5db;
    }
    
    .upload-modal-message {
        background: #374151;
        color: #e5e7eb;
        border-left-color: #60a5fa;
    }
    
    .upload-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .upload-input:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    }
    
    .upload-input::placeholder {
        color: #9ca3af;
    }
    
    .upload-btn-secondary {
        background: #374151;
        color: #f9fafb;
        border-color: #4b5563;
    }
    
    .upload-btn-secondary:hover {
        background: #4b5563;
        border-color: #6b7280;
    }
}

/* Print styles (hide modals when printing) */
@media print {
    .upload-modal-overlay {
        display: none !important;
    }
}

/* Upload Handler Modal Styles */
.upload-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-modal-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.upload-modal-wide {
    max-width: 700px;
}

.upload-modal-title {
    margin: 0 0 16px 0;
    font-size: 1.25em;
    font-weight: bold;
    color: #333;
}

.upload-title-success {
    color: #28a745;
}

.upload-title-error {
    color: #dc3545;
}

.upload-title-info {
    color: #17a2b8;
}

.upload-modal-text {
    margin: 0 0 12px 0;
    line-height: 1.4;
    color: #666;
}

.upload-reason-text {
    font-style: italic;
    color: #888;
}

.upload-modal-message-container {
    margin-bottom: 20px;
}

.upload-form-group {
    margin: 16px 0;
}

.upload-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.upload-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.upload-button-group {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.upload-btn {
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-btn-primary {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.upload-btn-primary:hover {
    background: #0056b3;
}

.upload-btn-secondary {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

.upload-btn-secondary:hover {
    background: #545b62;
}

.upload-btn-danger {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.upload-btn-danger:hover {
    background: #c82333;
}

/* Skipped Files Section */
.upload-skipped-files-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 16px;
    margin-top: 16px;
}

.upload-section-title {
    margin: 0 0 12px 0;
    font-size: 1em;
    font-weight: bold;
    color: #495057;
}

.upload-skip-reason-group {
    margin-bottom: 12px;
}

.upload-skip-reason-group:last-child {
    margin-bottom: 0;
}

.upload-file-list {
    margin: 8px 0 0 20px;
    padding: 0;
}

.upload-file-list li {
    margin-bottom: 4px;
    font-family: monospace;
    font-size: 0.9em;
    word-break: break-all;
}

.upload-summary {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #dee2e6;
}

.upload-summary ul {
    margin: 8px 0 0 20px;
    padding: 0;
}

.upload-summary li {
    margin-bottom: 4px;
}

/* Execution Log Styles */
.upload-execution-log-container {
    margin: 16px 0;
}

.upload-log-label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #495057;
}

.upload-execution-log {
    width: 100%;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #f8f9fa;
    resize: vertical;
    box-sizing: border-box;
}

/* Toast Message */
.upload-toast-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s;
    max-width: 300px;
}

.upload-toast-message.show {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .upload-modal-content {
        width: 95%;
        padding: 16px;
        margin: 10px;
    }
    
    .upload-modal-wide {
        max-width: none;
    }
    
    .upload-button-group {
        flex-direction: column;
    }
    
    .upload-btn {
        width: 100%;
    }
}