:root {
    --bg-color: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
    --po-color: #10b981; /* Emerald */
    --po-glow: rgba(16, 185, 129, 0.4);
    --retur-color: #ef4444; /* Red */
    --retur-glow: rgba(239, 68, 68, 0.4);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.08);
    --font-family: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Effects */
.background-effects {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
}
.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.5;
}
.glow-1 {
    top: -10%; left: -10%;
    width: 50vw; height: 50vw;
    background: radial-gradient(circle, rgba(16,185,129,0.15) 0%, rgba(0,0,0,0) 70%);
}
.glow-2 {
    bottom: -10%; right: -10%;
    width: 60vw; height: 60vw;
    background: radial-gradient(circle, rgba(239,68,68,0.1) 0%, rgba(0,0,0,0) 70%);
}
.glow-3 {
    top: 40%; left: 40%;
    width: 40vw; height: 40vw;
    background: radial-gradient(circle, rgba(59,130,246,0.1) 0%, rgba(0,0,0,0) 70%);
}

#svg-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}
header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #0f172a, #334155);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}
header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Main Layout */
.main-content {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

/* Graph Container */
.graph-container {
    flex: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
    z-index: 2;
}

.column.retailers {
    gap: 1.5rem;
}

/* Nodes */
.node {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    width: 260px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
}

.node:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    border-color: rgba(0,0,0,0.2);
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.retail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.logo-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

.logo-placeholder.bk {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
}

.logo-img {
    max-width: 100px;
    height: 48px;
    border-radius: 8px;
    object-fit: contain;
    background: transparent;
}

.logo-placeholder.ck {
    background: linear-gradient(135deg, #e11d48, #9f1239); /* Circle K red theme */
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    color: #fff;
}

.node-title h3 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}
.node-title p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Actions */
.actions {
    display: flex;
    gap: 0.5rem;
}

.btn {
    flex: 1;
    padding: 0.6rem 0;
    border: none;
    border-radius: 8px;
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-po {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--po-color);
    color: var(--po-color);
}
.btn-po:hover {
    background: var(--po-color);
    color: #fff;
    box-shadow: 0 0 15px var(--po-glow);
}

.btn-retur {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--retur-color);
    color: var(--retur-color);
}
.btn-retur:hover {
    background: var(--retur-color);
    color: #fff;
    box-shadow: 0 0 15px var(--retur-glow);
}

/* Table Section */
.table-section {
    flex: 1;
    min-width: 450px;
}
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.table-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0;
}
.summary-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
}
.stat {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.stat-label {
    color: var(--text-secondary);
    margin-right: 0.5rem;
    font-weight: 600;
}
#stat-po { color: var(--po-color); font-size: 1rem; }
#stat-retur { color: var(--retur-color); font-size: 1rem; }

.btn-export {
    background: #10b981; /* Emerald green for Excel vibe */
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}
.btn-export:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.4);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1px; /* for inner border effect */
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

th {
    background: rgba(0,0,0,0.05);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

tbody tr {
    transition: background 0.3s ease;
}
tbody tr:hover {
    background: rgba(0,0,0,0.02);
}

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

.badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}
.badge.po {
    background: rgba(16, 185, 129, 0.15);
    color: var(--po-color);
}
.badge.retur {
    background: rgba(239, 68, 68, 0.15);
    color: var(--retur-color);
}
.badge.status-ok {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 100%;
    max-width: 450px;
    padding: 2rem;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}
.close-btn:hover {
    color: #000;
}

.details-box {
    background: rgba(0,0,0,0.05);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}
.detail-row span {
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    gap: 1rem;
}

.btn-cancel {
    background: rgba(0,0,0,0.05);
    color: var(--text-primary);
}
.btn-cancel:hover {
    background: rgba(0,0,0,0.1);
}

.date-input {
    background: transparent;
    border: 1px solid rgba(0,0,0,0.15);
    color: var(--text-primary);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    outline: none;
}
.date-input:focus {
    border-color: var(--po-color);
}

/* Animations */
@keyframes dash-flow {
    to {
        stroke-dashoffset: -40;
    }
}
@keyframes dash-flow-reverse {
    to {
        stroke-dashoffset: 40;
    }
}

.svg-path {
    fill: none;
    stroke-width: 2;
    transition: stroke 0.3s ease, stroke-width 0.3s ease;
}

.svg-path.idle {
    stroke: rgba(0, 0, 0, 0.15);
    stroke-dasharray: 6 6;
}

.svg-path.active-po {
    stroke: var(--po-color);
    stroke-width: 3;
    stroke-dasharray: 8 8;
    animation: dash-flow 0.8s linear infinite;
    filter: drop-shadow(0 0 8px var(--po-glow));
}

.svg-path.active-retur {
    stroke: var(--retur-color);
    stroke-width: 3;
    stroke-dasharray: 8 8;
    animation: dash-flow-reverse 0.8s linear infinite;
    filter: drop-shadow(0 0 8px var(--retur-glow));
}
