/**
 * Admin Panel Custom Styles
 * News Pipeline Admin UI
 * Works with Tailwind CSS CDN
 */

/* ===== CSS Variables ===== */
:root {
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --shadow-card: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-card-hover: 0 4px 6px -1px rgb(0 0 0 / 0.1),
        0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* ===== Animations ===== */
.flash-message {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-fade-in {
    animation: fadeIn 0.2s ease-out;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===== Navigation Enhancements ===== */
.nav-gradient {
    background: var(--primary-gradient);
}

.nav-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

/* ===== Card Enhancements ===== */
.card-hover {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card-hover:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
}

/* ===== Stats Cards ===== */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon-primary {
    background: rgba(79, 70, 229, 0.1);
    color: #4f46e5;
}

.stat-icon-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-icon-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.stat-icon-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* ===== Pipeline Visualization ===== */
.pipeline-flow {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
    overflow-x: auto;
}

.pipeline-stage {
    flex-shrink: 0;
    background: white;
    border-radius: 12px;
    padding: 16px;
    min-width: 160px;
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
    position: relative;
}

.pipeline-stage:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.pipeline-stage::after {
    content: "→";
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    color: #d1d5db;
    font-size: 20px;
}

.pipeline-stage:last-child::after {
    display: none;
}

.pipeline-stage-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
    font-size: 14px;
}

.pipeline-stats-mini {
    display: flex;
    gap: 12px;
    font-size: 12px;
}

.pipeline-stat-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pipeline-stat-value {
    font-weight: 700;
    font-size: 18px;
}

.pipeline-stat-value.success {
    color: #10b981;
}
.pipeline-stat-value.pending {
    color: #f59e0b;
}
.pipeline-stat-value.failed {
    color: #ef4444;
}
.pipeline-stat-value.total {
    color: #6b7280;
}

.pipeline-stat-label {
    color: #9ca3af;
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 500;
}

/* ===== Table Enhancements ===== */
.table-row-hover tr {
    transition: background-color 0.15s ease;
}

.table-row-hover tr:hover {
    background-color: #f9fafb;
}

.table-sortable th {
    cursor: pointer;
    user-select: none;
}

.table-sortable th:hover {
    background-color: #e5e7eb;
}

.sort-indicator {
    display: inline-block;
    margin-left: 4px;
    opacity: 0.5;
}

.sort-indicator.active {
    opacity: 1;
}

/* ===== Form Enhancements ===== */
.form-input-icon {
    position: relative;
}

.form-input-icon input {
    padding-left: 40px;
}

.form-input-icon .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

.form-group-inline {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

/* ===== Button Enhancements ===== */
.btn-gradient {
    background: var(--primary-gradient);
    color: white;
    border: none;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.btn-gradient:hover {
    opacity: 0.9;
}

.btn-gradient:active {
    transform: scale(0.98);
}

.btn-icon-only {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ===== Badge Enhancements ===== */
.badge-pulse {
    position: relative;
}

.badge-pulse::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: inherit;
    opacity: 0.4;
    animation: pulse 2s infinite;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #9ca3af;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 14px;
    color: #6b7280;
    max-width: 300px;
    margin: 0 auto;
}

/* ===== Loading States ===== */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 60%;
}

/* ===== Tooltips ===== */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: #1f2937;
    color: white;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    margin-bottom: 6px;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ===== Progress Bar ===== */
.progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar-success .progress-bar-fill {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.progress-bar-warning .progress-bar-fill {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.progress-bar-danger .progress-bar-fill {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

/* ===== Responsive Improvements ===== */
@media (max-width: 768px) {
    .responsive-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .responsive-hide {
        display: none;
    }

    .responsive-stack {
        flex-direction: column;
    }

    .pipeline-flow {
        padding: 12px;
    }

    .pipeline-stage {
        min-width: 140px;
        padding: 12px;
    }
}

/* ===== Print Styles ===== */
@media print {
    .no-print {
        display: none !important;
    }

    .print-break {
        page-break-before: always;
    }
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ===== Focus States ===== */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

/* ===== Dark Mode Support (future) ===== */
@media (prefers-color-scheme: dark) {
    /* Placeholder for dark mode styles */
}
