/* Custom CSS for Storage Metrics Dashboard */
/* Add any custom overrides or additional styles here */

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1f2937;
    --darker: #111827;
    --light: #f3f4f6;
    --border: #e5e7eb;
    --text: #374151;
    --text-light: #6b7280;
}

/* Additional custom styles can be added here */

*, *::before, *::after { box-sizing: border-box; }
:root {
    --teal:   #0d9488; --teal-lt:#ccfbf1;
    --bg:     #f1f5f9; --card:   #ffffff;
    --border: #e2e8f0; --text:   #0f172a;
    --muted:  #64748b; --faint:  #94a3b8;
}
body { font-family:'Plus Jakarta Sans',sans-serif; background:var(--bg); color:var(--text); min-height:100vh; }
.mono { font-family:'JetBrains Mono',monospace; }

.card    { background:var(--card); border:1px solid var(--border); border-radius:1.5rem; box-shadow:0 1px 3px rgba(0,0,0,.04),0 4px 12px rgba(0,0,0,.04); }
.card-sm { background:var(--card); border:1px solid var(--border); border-radius:1rem;   box-shadow:0 1px 2px rgba(0,0,0,.04); }

.field { background:#fff; border:1.5px solid var(--border); border-radius:.875rem; padding:.75rem 1rem; font-size:.875rem; color:var(--text); width:100%; transition:border-color .15s,box-shadow .15s; font-family:inherit; }
.field:focus { outline:none; border-color:var(--teal); box-shadow:0 0 0 4px rgba(13,148,136,.1); }
.field:disabled { background: #f8fafc; color: var(--faint); cursor: not-allowed; border-color: var(--border); }
.field::placeholder { color:var(--faint); }
label.lbl { display:block; font-size:.6875rem; font-weight:700; letter-spacing:.1em; text-transform:uppercase; color:var(--faint); margin-bottom:.4rem; }

.btn-primary { width:100%; background:#0f172a; color:#fff; border:none; border-radius:1rem; padding:1rem; font-weight:700; font-size:.9375rem; letter-spacing:.02em; cursor:pointer; transition:background .15s,transform .1s; box-shadow:0 4px 14px rgba(15,23,42,.18); }
.btn-primary:hover  { background:#1e293b; }
.btn-primary:active { transform:scale(.98); }
.btn-primary.success { background:var(--teal); box-shadow:0 4px 14px rgba(13,148,136,.25); }
.btn-abort { width:100%; background:transparent; border:1.5px solid #fecdd3; border-radius:1rem; padding:.75rem; font-weight:700; font-size:.75rem; letter-spacing:.1em; text-transform:uppercase; color:#e11d48; cursor:pointer; transition:background .15s; }
.btn-abort:hover { background:#fff1f2; }

.badge { display:inline-flex; align-items:center; gap:.3rem; padding:.25rem .65rem; border-radius:9999px; font-size:.6875rem; font-weight:700; letter-spacing:.05em; text-transform:uppercase; }
.badge.idle      { background:#f1f5f9; color:var(--muted); }
.badge.running   { background:#ccfbf1; color:#0f766e; }
.badge.done      { background:#dcfce7; color:#166534; }
.badge.aborted   { background:#fff1f2; color:#be123c; }
.badge.failed    { background:#fff1f2; color:#be123c; }
.badge.pending   { background:#fef9c3; color:#854d0e; }
.badge.completed { background:#dcfce7; color:#166534; }

.step-pill { display:inline-flex; align-items:center; gap:.375rem; background:#f8fafc; border:1px solid var(--border); border-radius:9999px; padding:.25rem .75rem .25rem .4rem; font-size:.6875rem; font-weight:600; color:var(--muted); }

.timeline-wrap  { position:relative; padding-left:2.25rem; }
.timeline-track { position:absolute; left:.9375rem; top:1.5rem; bottom:1.5rem; width:2px; background:var(--border); border-radius:1px; }
.timeline-fill  { position:absolute; left:.9375rem; top:1.5rem; width:2px; background:var(--teal); border-radius:1px; height:0%; transition:height .6s cubic-bezier(.4,0,.2,1); }
.stage-row { position:relative; padding:.875rem 1rem; border-radius:1rem; border:1px solid transparent; transition:all .35s ease; margin-bottom:.625rem; }
.stage-row .sdot {
    position: absolute;
    left: -1.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--border);
    z-index: 10;
    transition: all .35s ease;

    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
}

.stage-row.s-done {
    background: #f0fdf9;
    border-color: #99f6e4;
}

.stage-row.s-done .sdot {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff; /* icon color */
}
.stage-row.s-active { background:#fff; border-color:#5eead4; box-shadow:0 4px 16px rgba(13,148,136,.1); }
.stage-row.s-active .sdot { background:#fff; border-color:var(--teal); border-width:2.5px; animation:pulse-dot 1.6s ease infinite; }
.stage-row.s-idle   { opacity:.4; }
@keyframes pulse-dot { 0%,100%{box-shadow:0 0 0 0 rgba(13,148,136,.4);}50%{box-shadow:0 0 0 5px rgba(13,148,136,0);} }

.arc-wrap  { position:relative; width:7rem; height:7rem; flex-shrink:0; }
.arc-wrap svg { transform:rotate(-90deg); }
.arc-bg    { fill:none; stroke:#e2e8f0; stroke-width:7; }
.arc-fill  { fill:none; stroke:var(--teal); stroke-width:7; stroke-linecap:round; stroke-dasharray:201; stroke-dashoffset:201; transition:stroke-dashoffset .6s ease; }
.arc-label { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }

.metric { background:#f8fafc; border:1px solid var(--border); border-radius:1rem; padding:.875rem 1.125rem; min-width:0; }

.log-feed { height:100%; overflow-y:auto; display:flex; flex-direction:column; gap:.25rem; scroll-behavior:smooth; }
.log-feed::-webkit-scrollbar { width:3px; }
.log-feed::-webkit-scrollbar-thumb { background:var(--border); border-radius:2px; }
.log-line { display:flex; gap:.5rem; align-items:baseline; animation:fadeUp .25s ease; }
@keyframes fadeUp { from{opacity:0;transform:translateY(4px);}to{opacity:1;transform:translateY(0);} }

.has-tip { position:relative; cursor:help; }
.tip { visibility:hidden; opacity:0; position:absolute; bottom:130%; left:50%; transform:translateX(-50%); background:#0f172a; color:#fff; font-size:.6875rem; font-weight:500; padding:.35rem .65rem; border-radius:.5rem; white-space:nowrap; transition:opacity .15s; z-index:99; pointer-events:none; }
.has-tip:hover .tip { visibility:visible; opacity:1; }

.fadeable { transition:opacity .4s ease; }
.dimmed   { opacity:.35; pointer-events:none; }

@keyframes shimmer { 0%{background-position:-300% 0;}100%{background-position:300% 0;} }
.shimmer { background:linear-gradient(90deg,#f0fdf9 25%,#ffffff 50%,#f0fdf9 75%); background-size:300% 100%; animation:shimmer 2.5s infinite linear; }

/* History */
.hist-item { border:1px solid var(--border); border-radius:1rem; padding:.875rem 1rem; transition:all .2s ease; background:#fff; cursor:pointer; }
.hist-item:hover { border-color:#94a3b8; box-shadow:0 2px 8px rgba(0,0,0,.06); transform:translateY(-1px); }
.hist-item.hi-completed { border-left:3px solid #10b981; }
.hist-item.hi-running   { border-left:3px solid var(--teal); }
.hist-item.hi-failed    { border-left:3px solid #f43f5e; }
.hist-item.hi-aborted   { border-left:3px solid #fb923c; }
.hist-item.hi-pending   { border-left:3px solid #facc15; }

.hist-scroll { max-height:calc(100vh - 20rem); overflow-y:auto; display:flex; flex-direction:column; gap:.625rem; }
.hist-scroll::-webkit-scrollbar { width:3px; }
.hist-scroll::-webkit-scrollbar-thumb { background:var(--border); border-radius:2px; }

.stat-box { background:#f8fafc; border:1px solid var(--border); border-radius:.875rem; padding:.75rem .875rem; text-align:center; }

.dl-btn { display:inline-flex; align-items:center; gap:.3rem; font-size:.6875rem; font-weight:700; padding:.3rem .75rem; border-radius:.5rem; border:1px solid; cursor:pointer; transition:all .15s; text-decoration:none; }
.dl-btn.enabled  { border-color:#10b981; color:#059669; background:#f0fdf4; }
.dl-btn.enabled:hover { background:#dcfce7; }
.dl-btn.disabled { border-color:var(--border); color:var(--faint); background:#f8fafc; cursor:not-allowed; pointer-events:none; }

/* Source tag */
.src-tag { display:inline-flex; align-items:center; gap:.25rem; font-size:.6rem; font-weight:700; letter-spacing:.07em; text-transform:uppercase; padding:.15rem .5rem; border-radius:9999px; }
.src-tag.local   { background:#eff6ff; color:#3b82f6; border:1px solid #bfdbfe; }
.src-tag.backend { background:#f0fdf4; color:#22c55e; border:1px solid #bbf7d0; }

/* Detail drawer */
#detail-drawer { transition:all .25s ease; }
.detail-row { display:flex; justify-content:space-between; align-items:flex-start; gap:.75rem; padding:.5rem 0; border-bottom:1px solid #f1f5f9; }
.detail-row:last-of-type { border-bottom:none; }

@keyframes ping { 75%,100%{transform:scale(2);opacity:0;} }
.ping { animation:ping 1s cubic-bezier(0,0,.2,1) infinite; }

.ol-scale-line {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(4px);
    border-radius: 6px;
    padding: 4px 8px !important;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.ol-scale-line-inner {
    border: 2px solid #475569 !important;
    border-top: none !important;
    color: #475569 !important;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px !important;
    font-weight: 700;
    text-align: center;
    margin: 0;
}
.ol-mouse-position {
    position: static !important;
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ========================================================
   Mobile Responsiveness Overrides
   (Activates on screens smaller than 1024px / lg in Tailwind)
   ======================================================== */
@media (max-width: 1023px) {
    /* Allow the history scroll to flow naturally on mobile */
    .hist-scroll { 
        max-height: none; 
    }
    
    /* Shrink the size of map scale line so it doesn't clip on small phones */
    .ol-scale-line {
        padding: 2px 4px !important;
        bottom: 8px !important;
        left: 8px !important;
    }
    .ol-scale-line-inner {
        font-size: 9px !important;
    }
    
    /* Slightly reduce padding in inputs to save space */
    .card {
        border-radius: 1rem; /* Slightly softer corners on mobile */
    }
    
    /* Shrink timeline gaps to fit more on screen without intense scrolling */
    .stage-row {
        padding: 0.6rem 0.75rem;
        margin-bottom: 0.4rem;
    }
    .timeline-wrap {
        padding-left: 1.75rem;
    }
    .timeline-track, .timeline-fill {
        left: 0.5rem;
    }
    .stage-row .sdot {
        left: -1.25rem;
        width: 1.25rem;
        height: 1.25rem;
        font-size: 10px;
    }
}

.tabs-wrapper {
    container-type: inline-size;
    width: 100%; /* Or any width; the child reacts to this */
  }

@container (min-width: 570px) {
    #status-tabs {
      display: flex;
    }
    #filter-div {
        justify-content: end;
    }
  }

@container (max-width: 570px) {
    #status-dropdown-wrapper {
      display: flex;
    }
    #filter-div {
        justify-content: space-between;
    }
  }