/* =============================================
   FLOATING WIDGETS — Timer Tracker + Animal Care
   ============================================= */

/* --- Shared widget button --- */
#timerWidgetBtn,
#animalWidgetBtn {
    position: fixed;
    bottom: 80px;
    z-index: 9000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    transition: transform 0.15s, border-color 0.15s;
    user-select: none;
}
#timerWidgetBtn { right: 64px; font-size: 18px; }
#animalWidgetBtn { right: 116px; font-size: 18px; }
#timerWidgetBtn:hover,
#animalWidgetBtn:hover {
    transform: scale(1.1);
    border-color: var(--accent, var(--primary));
}

/* --- Shared badge --- */
.tw-badge,
.aw-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e74c3c;
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    pointer-events: none;
}

/* --- Shared panel base --- */
.tw-panel,
.aw-panel {
    position: fixed;
    bottom: 140px;
    width: 300px;
    max-height: 65vh;
    z-index: 10000;
    background: var(--surface);
    border: 2px solid var(--primary);
    border-radius: 14px;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.05);
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tw-panel { right: 56px; }
.aw-panel { right: 108px; }

.tw-panel.tw-open,
.aw-panel.aw-open {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}
.tw-panel.tw-closing,
.aw-panel.aw-closing {
    opacity: 0;
    transform: scale(0.05);
    transition: opacity 0.18s ease, transform 0.18s ease !important;
}

/* --- Panel inner layout --- */
.tw-panel-inner,
.aw-panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* --- Panel header --- */
.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 10px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
    cursor: move;
    touch-action: none;
    user-select: none;
}
.widget-header h3 {
    margin: 0;
    font-size: 14px;
    color: var(--primary);
}
.widget-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.widget-close:hover { color: var(--text); }

/* --- Panel body (scrollable) --- */
.widget-body {
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
}
.widget-body:empty::after {
    content: 'Nothing to show';
    display: block;
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

/* --- Timer rows --- */
.tw-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-bottom: 1px solid #1e1e1e;
    font-size: 12px;
}
.tw-row:last-child { border-bottom: none; }
.tw-row-icon {
    font-size: 15px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}
.tw-row-label {
    flex: 1;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tw-row-time {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    font-size: 11px;
}
.tw-row-time.tw-ready {
    color: #2ecc71;
    font-weight: bold;
}
.tw-section-label {
    padding: 6px 14px 3px;
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* --- Animal rows --- */
.aw-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-bottom: 1px solid #1e1e1e;
    font-size: 12px;
}
.aw-row:last-child { border-bottom: none; }
.aw-row-icon {
    font-size: 15px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}
.aw-row-label {
    flex: 1;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.aw-row-status {
    flex-shrink: 0;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.aw-status-ready    { background: #1a472a; color: #2ecc71; }
.aw-status-hungry   { background: #4a2a0a; color: #e67e22; }
.aw-status-unhappy  { background: #3a1a2a; color: #e74c3c; }
.aw-status-ok       { background: #1a2a1a; color: #7fba7f; }

/* bar under icon for hunger / happiness */
.aw-bars {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 40px;
    flex-shrink: 0;
}
.aw-bar-track {
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
}
.aw-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}
.aw-bar-hunger  { background: #e67e22; }
.aw-bar-happy   { background: #3498db; }

/* --- No-animals placeholder --- */
.aw-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

/* --- Mobile adjustments --- */
@media (max-width: 600px) {
    #timerWidgetBtn { right: 60px; bottom: 74px; }
    #animalWidgetBtn { right: 112px; bottom: 74px; }
    .tw-panel { right: 6px; width: calc(100vw - 12px); max-width: 300px; }
    .aw-panel { right: 6px; width: calc(100vw - 12px); max-width: 300px; }
}
