/*
 * SchemeSeeker - Centralized Application Styles
 * All card, tile, hover, and utility styles for the entire platform.
 * Based on PageStructure.cshtml patterns and Arclon theme variables.
 * Note: Uses .card.stats-card specificity to override Arclon theme's .card base rules.
 */

/* ============================================
   CARD-HEADER FIX
   Arclon theme .card .card-header { border-bottom: 0 } removes borders.
   We use same specificity + later source order to restore them.
   ============================================ */
.card .card-header.border-bottom {
    border-bottom: 1px solid var(--ct-border-color, #e7e9eb) !important;
}

/* ============================================
   STATS CARDS (Key Metric Tiles)
   Usage: <div class="card stats-card" style="--card-accent: var(--ct-primary);">
   ============================================ */
.card.stats-card {
    border: none;
    border-top: 3px solid var(--card-accent, var(--ct-primary));
    border-radius: 0.5rem;
    padding: 1.25rem 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    -webkit-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
}

.card.stats-card:hover {
    -webkit-transform: translateY(-6px) scale(1.02);
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 12px 35px color-mix(in srgb, var(--card-accent, var(--ct-primary)) 30%, transparent),
                0 4px 15px rgba(0, 0, 0, 0.08) !important;
}

.stats-number {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stats-label {
    font-size: 0.8rem;
    color: var(--ct-secondary-color, #8e92ad);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 0;
}

/* ============================================
   HOVER-LIFT EFFECT (Generic Cards)
   Usage: <div class="card hover-lift">
   ============================================ */
.card.hover-lift {
    -webkit-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.hover-lift:hover {
    -webkit-transform: translateY(-5px);
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(20, 120, 240, 0.15),
                0 4px 12px rgba(0, 0, 0, 0.06) !important;
}

/* ============================================
   SCHEME BROWSE CARDS
   Usage: <div class="card scheme-card">
   ============================================ */
.card.scheme-card {
    background: rgba(var(--ct-light-rgb, 255, 255, 255), 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(var(--ct-white-rgb, 255, 255, 255), 0.05);
    -webkit-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.scheme-card:hover {
    background: rgba(var(--ct-light-rgb, 255, 255, 255), 0.07);
    -webkit-transform: translateY(-6px);
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(var(--ct-primary-rgb), 0.15),
                0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.glass-panel {
    background: rgba(var(--ct-light-rgb, 255, 255, 255), 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(var(--ct-white-rgb, 255, 255, 255), 0.05);
    border-radius: 0.75rem;
}

/* ============================================
   TRANSITION UTILITY
   Usage: class="transition-all"
   ============================================ */
.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 300ms;
}

/* ============================================
   LINE CLAMP UTILITIES (Text Truncation)
   Usage: class="line-clamp-2"
   ============================================ */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================
   INLINE EDIT PANEL
   Usage: <div class="edit-panel">
   ============================================ */
.edit-panel {
    background: var(--ct-tertiary-bg, #f6f7fb);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid var(--ct-border-color, #e7e9eb);
}

/* ============================================
   COMPARISON TABLE
   Usage: <table class="table comparison-table">
   ============================================ */
.comparison-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.01);
}

.comparison-table td,
.comparison-table th {
    vertical-align: top;
    border-bottom: 1px solid var(--ct-border-color, #eee);
}

/* ============================================
   TIMELINE (Scheme Detail - Application Steps)
   ============================================ */
.timeline::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 15px;
    width: 2px;
    background: rgba(255, 255, 255, 0.2);
}

.timeline li {
    position: relative;
    z-index: 1;
}

/* ============================================
   SOFT BACKGROUND UTILITIES
   ============================================ */
.bg-soft-success {
    background-color: rgba(48, 207, 70, 0.1);
}

.bg-soft-info {
    background-color: rgba(75, 190, 225, 0.1);
}

.bg-soft-warning {
    background-color: rgba(250, 174, 55, 0.1);
}

.bg-soft-danger {
    background-color: rgba(248, 63, 50, 0.1);
}

.bg-soft-primary {
    background-color: rgba(20, 120, 240, 0.1);
}

.bg-soft-secondary {
    background-color: rgba(91, 105, 188, 0.1);
}

/* ============================================
   LOADING ANIMATION
   Usage: <i class="ti ti-loader rotating"></i>
   ============================================ */
.rotating {
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ============================================
   LETTER SPACING UTILITY (OTP Input)
   ============================================ */
.letter-spacing-2 {
    letter-spacing: 0.5rem;
}

/* ============================================
   TABLE ENHANCEMENTS
   Hover-friendly tables within cards
   ============================================ */
.table-hover tbody tr {
    transition: background-color 0.15s ease;
}

/* ============================================
   BADGE OVERRIDE (Consistent Padding)
   ============================================ */
.badge {
    padding: 0.5em 0.8em;
    font-weight: 500;
}

/* ============================================
   CURSOR UTILITY
   ============================================ */
.cursor-pointer {
    cursor: pointer;
}

/* ============================================
   LIVE JOB PROGRESS MONITORING
   ============================================ */

/* --- Job Progress Card (Glassmorphic) --- */
.job-progress-card {
    background: var(--ct-card-bg, #fff);
    border: 1px solid var(--ct-border-color, #e7e9eb);
    border-left: 4px solid var(--job-color, var(--ct-primary));
    border-radius: 0.625rem;
    padding: 1.25rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: jobCardSlideIn 0.3s ease-out;
}

.job-progress-card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.job-progress-card.job-completed {
    opacity: 0.75;
}

@keyframes jobCardSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Job Icon Circle --- */
.job-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* --- Gradient Progress Bar --- */
.progress-gradient {
    background: linear-gradient(90deg, #198754, #0dcaf0, #6f42c1);
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Pulse Badge (Running Status) --- */
.pulse-badge {
    position: relative;
    color: #fff;
}

.pulse-badge::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: inherit;
    background: inherit;
    opacity: 0.5;
    animation: pulseGlow 2s ease-in-out infinite;
    z-index: -1;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(1.15); }
}

/* --- Counter Values (Tabular for non-jittery updates) --- */
.counter-value {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    transition: color 0.3s ease;
    font-size: 0.95rem;
}

/* --- Stat Micro Cards (The 6-grid counters) --- */
.stat-micro-card {
    text-align: center;
    padding: 0.5rem 0.25rem;
    border-radius: 0.5rem;
    background: var(--ct-tertiary-bg, #f6f7fb);
    border: 1px solid var(--ct-border-color, #e7e9eb);
    transition: transform 0.2s ease;
}

.stat-micro-card:hover {
    transform: scale(1.05);
}

.stat-micro-card .counter-value {
    font-size: 1.1rem;
    line-height: 1.3;
}

.stat-micro-label {
    font-size: 0.65rem;
    color: var(--ct-secondary-color, #8e92ad);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* --- Current Item Indicator --- */
.current-item-indicator {
    font-family: 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 0.78rem;
    color: var(--ct-secondary-color, #8e92ad);
    background: var(--ct-tertiary-bg, #f6f7fb);
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    border-left: 3px solid var(--job-color, var(--ct-primary));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Error Log Stream --- */
.error-log-stream {
    max-height: 150px;
    overflow-y: auto;
    background: rgba(220, 53, 69, 0.04);
    border: 1px solid rgba(220, 53, 69, 0.15);
    border-radius: 0.375rem;
    padding: 0.5rem;
}

.error-line {
    font-family: 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 0.72rem;
    color: #dc3545;
    padding: 0.15rem 0;
    border-bottom: 1px solid rgba(220, 53, 69, 0.08);
}

.error-line:last-child {
    border-bottom: none;
}

@keyframes errorFlashIn {
    from { background: rgba(220, 53, 69, 0.2); }
    to   { background: transparent; }
}

.error-flash {
    animation: errorFlashIn 1.5s ease-out;
}

/* --- Diagnostic Log Stream --- */
.log-stream {
    max-height: 180px;
    overflow-y: auto;
    background: var(--ct-tertiary-bg, #f6f7fb);
    border: 1px solid var(--ct-border-color, #e7e9eb);
    border-radius: 0.375rem;
    padding: 0.5rem;
}

.log-line {
    font-family: 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 0.72rem;
    color: var(--ct-secondary-color, #8e92ad);
    padding: 0.1rem 0;
    border-bottom: 1px solid var(--ct-border-color, #e7e9eb);
}

.log-line:last-child {
    border-bottom: none;
}

/* --- Scrollbar Styling for Log Streams --- */
.log-stream::-webkit-scrollbar,
.error-log-stream::-webkit-scrollbar {
    width: 4px;
}

.log-stream::-webkit-scrollbar-thumb,
.error-log-stream::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

.log-stream::-webkit-scrollbar-track,
.error-log-stream::-webkit-scrollbar-track {
    background: transparent;
}
