/* Base Template Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #f8f9fc;
    color: #1f2937;
    line-height: 1.6;
}

/* Nav link styles (used in base.html header) */
.nav-link,
.nav-link:visited {
    text-decoration: none;
    color: #3949ab;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
    color: #1a237e;
    background: #e8eaf6;
}

/* Messages styling */
.messages {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.message {
    background: #ffffff;
    border-left: 4px solid #3b82f6;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease-out;
}

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

.message.success {
    border-left-color: #10b981;
}

.message.error {
    border-left-color: #ef4444;
}

.message.warning {
    border-left-color: #f59e0b;
}

.message.info {
    border-left-color: #3b82f6;
}

.message-inner-frame {
    flex: 1;
    font-size: 0.95rem;
    color: #1f2937;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    margin-left: 1rem;
    line-height: 1;
}

.close-btn:hover {
    color: #4b5563;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .messages {
        right: 10px;
        left: 10px;
        max-width: none;
        top: 70px;
    }
}

/* ── Live update row flash animations ── */
@keyframes flash-position-up {
    0%   { background-color: #d1fae5; } /* green-100 */
    60%  { background-color: #d1fae5; }
    100% { background-color: transparent; }
}
@keyframes flash-position-down {
    0%   { background-color: #fee2e2; } /* red-100 */
    60%  { background-color: #fee2e2; }
    100% { background-color: transparent; }
}
@keyframes flash-position-new {
    0%   { background-color: #dbeafe; } /* blue-100 */
    60%  { background-color: #dbeafe; }
    100% { background-color: transparent; }
}
@keyframes flash-position-neutral {
    0%   { background-color: #fef9c3; } /* yellow-100 */
    60%  { background-color: #fef9c3; }
    100% { background-color: transparent; }
}

tr[data-position-change="up"]      { animation: flash-position-up      2.5s ease-out forwards; }
tr[data-position-change="down"]    { animation: flash-position-down    2.5s ease-out forwards; }
tr[data-position-change="new"]     { animation: flash-position-new     2.5s ease-out forwards; }
tr[data-position-change="neutral"] { animation: flash-position-neutral 2.5s ease-out forwards; }

/* Loading indicator spinner for live updates */
.htmx-live-indicator {
    display: none;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}
.htmx-live-indicator.htmx-request { display: flex; }
.htmx-live-indicator-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: #40b4e0;
    animation: pulse-dot 1s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.75); }
}
