/* ===================================================================
   Import Terminal Component
   Terminal-style log viewer for import operations
   =================================================================== */

/* Terminal Container */
.import-terminal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

[data-theme="light"] .import-terminal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

.import-terminal-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Terminal Window */
.import-terminal {
    background: #1a1a2e;
    border: 1px solid #3a3a5a;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    height: 80vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.3s ease-out;
    overflow: hidden;
}

[data-theme="light"] .import-terminal {
    background: #1e1e1e;
    border: 1px solid #444;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Terminal Header (Title Bar) */
.import-terminal-header {
    background: linear-gradient(180deg, #2d2d4a 0%, #252542 100%);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #3a3a5a;
    user-select: none;
}

.import-terminal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e0e0e0;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 13px;
    font-weight: 500;
}

.import-terminal-title i {
    color: #00E5FF;
}

.import-terminal-buttons {
    display: flex;
    gap: 8px;
}

.terminal-btn {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.terminal-btn:hover {
    transform: scale(1.1);
}

.terminal-btn-close {
    background: #ff5f57;
}

.terminal-btn-close:hover {
    background: #ff3b30;
}

/* Terminal Body (Log Output) */
.import-terminal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Consolas', monospace;
    font-size: 12.5px;
    line-height: 1.6;
    color: #d4d4d4;
    background: #0d0d1a;
}

.import-terminal-body::-webkit-scrollbar {
    width: 8px;
}

.import-terminal-body::-webkit-scrollbar-track {
    background: #1a1a2e;
}

.import-terminal-body::-webkit-scrollbar-thumb {
    background: #3a3a5a;
    border-radius: 4px;
}

.import-terminal-body::-webkit-scrollbar-thumb:hover {
    background: #4a4a6a;
}

/* Log Entry Styles */
.log-entry {
    margin: 0;
    padding: 1px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.log-entry.indent-1 { padding-left: 20px; }
.log-entry.indent-2 { padding-left: 40px; }
.log-entry.indent-3 { padding-left: 60px; }
.log-entry.indent-4 { padding-left: 80px; }

/* Log Level Colors */
.log-entry.header {
    color: #00E5FF;
    font-weight: 600;
    margin-top: 8px;
}

.log-entry.divider {
    color: #00E5FF;
    opacity: 0.6;
}

.log-entry.success {
    color: #4ade80;
}

.log-entry.error {
    color: #f87171;
}

.log-entry.warning {
    color: #fbbf24;
}

.log-entry.info {
    color: #60a5fa;
}

.log-entry.debug {
    color: #9ca3af;
    font-size: 11.5px;
}

.log-entry.step {
    color: #c084fc;
    font-weight: 500;
    margin-top: 4px;
}

.log-entry.card {
    color: #e0e0e0;
}

/* Timestamp (optional, can be toggled) */
.log-timestamp {
    color: #6b7280;
    font-size: 11px;
    margin-right: 8px;
    opacity: 0.7;
}

/* Terminal Footer (Status Bar) */
.import-terminal-footer {
    background: linear-gradient(180deg, #252542 0%, #1d1d35 100%);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #3a3a5a;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 12px;
}

.import-terminal-stats {
    display: flex;
    gap: 20px;
}

.terminal-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.terminal-stat-label {
    color: #9ca3af;
}

.terminal-stat-value {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    min-width: 24px;
    text-align: center;
}

.terminal-stat-value.added {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

.terminal-stat-value.updated {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
}

.terminal-stat-value.failed {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
}

.terminal-stat-value.skipped {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.import-terminal-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9ca3af;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.processing {
    background: #00E5FF;
}

.status-indicator.complete {
    background: #4ade80;
    animation: none;
}

.status-indicator.error {
    background: #f87171;
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.9);
    }
}

/* Close Button */
.import-terminal-close-btn {
    background: #3a3a5a;
    color: #e0e0e0;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.import-terminal-close-btn:hover {
    background: #4a4a6a;
}

.import-terminal-close-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.import-terminal-close-btn i {
    font-size: 14px;
}

/* Blinking cursor effect at the end */
.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: #00E5FF;
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
    margin-left: 2px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Responsive */
@media (max-width: 768px) {
    .import-terminal {
        width: 95%;
        height: 90vh;
        border-radius: 8px;
    }
    
    .import-terminal-body {
        font-size: 11px;
    }
    
    .import-terminal-stats {
        flex-wrap: wrap;
        gap: 10px;
    }
}
