/* 
 * SAP Tracker Premium Glassmorphic Stylesheet 
 * Curated for a dark, glowing enterprise UI experience.
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #060913;
    --bg-gradient: linear-gradient(135deg, #060913 0%, #0d1527 50%, #080c18 100%);
    --panel-bg: rgba(13, 20, 38, 0.45);
    --panel-border: rgba(255, 255, 255, 0.06);
    --panel-glow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --color-accent: #6366f1; /* Neon Indigo */
    --color-accent-hover: #4f46e5;
    --color-purple: #a855f7; /* Violet */
    --color-emerald: #10b981; /* Success Green */
    --color-amber: #f59e0b; /* ECC Orange */
    --color-danger: #ef4444; /* Error Red */
    
    --font-sans: 'Plus Jakarta Sans', 'Outfit', system-ui, -apple-system, sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(6, 9, 19, 0.5);
}
::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.6);
}

/* Typography */
h1, h2, h3, h4 {
    font-family: 'Outfit', var(--font-sans);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Background Glowing Orbs */
.orb-1 {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}
.orb-2 {
    position: absolute;
    bottom: -10%;
    right: -10%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}

/* Layout Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header & Glassmorphism Navigation */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    background: rgba(13, 20, 38, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    box-shadow: var(--panel-glow);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--color-accent), var(--color-purple), transparent);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-purple) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.logo-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.logo-text h1 {
    font-size: 1.4rem;
    background: linear-gradient(90deg, #ffffff 30%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.nav-tabs {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.tab-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: white;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

/* Glassmorphic Panel Cards */
.panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    box-shadow: var(--panel-glow);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: var(--transition-smooth);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1rem;
}

.panel-title {
    font-size: 1.25rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Quick Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-accent);
}

.stat-card.ecc::before { background: var(--color-amber); }
.stat-card.s4::before { background: var(--color-emerald); }
.stat-card.scraped::before { background: var(--color-purple); }

.stat-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(99, 102, 241, 0.2);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-val {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-top: 0.25rem;
    font-family: 'Outfit', sans-serif;
}

.stat-icon {
    position: absolute;
    right: 1.25rem;
    bottom: 1.25rem;
    opacity: 0.15;
    color: white;
}

/* Visual Native Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 968px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.bar-chart-container {
    height: 300px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding-top: 2rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.bar-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    position: relative;
}

.chart-bar-group {
    width: 100%;
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 100%;
    justify-content: center;
}

.bar-part {
    width: 12px;
    border-radius: 4px 4px 0 0;
    transition: var(--transition-smooth);
    position: relative;
    cursor: pointer;
}

.bar-part.ecc {
    background: linear-gradient(to top, rgba(245, 158, 11, 0.3), var(--color-amber));
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.bar-part.s4 {
    background: linear-gradient(to top, rgba(16, 185, 129, 0.3), var(--color-emerald));
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.bar-part:hover {
    filter: brightness(1.2);
    transform: scaleX(1.15);
}

.bar-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 8px;
    transform: rotate(-45deg);
    white-space: nowrap;
}

.chart-tooltip {
    position: absolute;
    bottom: 105%;
    background: rgba(13, 20, 38, 0.95);
    border: 1px solid var(--color-accent);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    color: white;
    z-index: 10;
    pointer-events: none;
    display: none;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    white-space: nowrap;
}

.bar-part:hover .chart-tooltip {
    display: block;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

/* Location list progress bars */
.location-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.location-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.location-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.location-name {
    color: var(--text-primary);
}

.location-count {
    color: var(--text-secondary);
    font-weight: 600;
}

.progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--color-accent), var(--color-purple));
    transition: width 1s ease-out;
}

/* Filtering Toolbar & Forms */
.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.input-group {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.input-group.search {
    flex: 2;
}

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    color: white;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-accent);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.15);
}

.input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.input-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Dropdown styling */
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    font-family: var(--font-sans);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
    filter: brightness(1.1);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-purple {
    background: linear-gradient(135deg, var(--color-purple) 0%, #8b5cf6 100%);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.25);
}

.btn-purple:hover {
    box-shadow: 0 6px 16px rgba(168, 85, 247, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-danger) 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

/* Premium Tables */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.01);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    transition: var(--transition-smooth);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.company-cell {
    font-weight: 600;
    color: white;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.s4 {
    background: rgba(16, 185, 129, 0.12);
    color: var(--color-emerald);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge.ecc {
    background: rgba(245, 158, 11, 0.12);
    color: var(--color-amber);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.contact-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.contact-badge svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.link-btn {
    color: var(--color-accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.link-btn:hover {
    color: white;
    text-shadow: 0 0 10px rgba(99, 102, 241, 0.6);
}

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    stroke: var(--text-muted);
    stroke-width: 1.5;
    fill: none;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
}

/* Scraper Progress logs */
.scraper-console {
    background: #02040a;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1.25rem;
    font-family: monospace;
    font-size: 0.85rem;
    color: #38bdf8;
    height: 350px;
    overflow-y: auto;
    margin-top: 1rem;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

.console-line {
    margin-bottom: 0.4rem;
    word-break: break-all;
    line-height: 1.4;
}

.console-line.success { color: var(--color-emerald); }
.console-line.warn { color: var(--color-amber); }
.console-line.info { color: #94a3b8; }
.console-line.added { color: #a855f7; font-weight: bold; }

/* Exports Downloads Grid */
.downloads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 8px;
}

.download-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-smooth);
}

.download-card:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.2);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-icon {
    width: 38px;
    height: 38px;
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-amber);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-card.current .file-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-emerald);
}

.file-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.file-meta h4 {
    font-size: 0.95rem;
    color: white;
}

.file-meta p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Task Scheduler Management Panel */
.scheduler-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .scheduler-panel {
        grid-template-columns: 1fr;
    }
}

.scheduler-status {
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 1.5rem;
}

.status-badge-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.status-indicator.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-emerald);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-indicator.inactive {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-meta-row {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
}

.status-meta-row span:first-child {
    color: var(--text-secondary);
}

.status-meta-row span:last-child {
    color: white;
    font-weight: 500;
}
