/* File: css/style.css */
/* Created: 2025-04-09 07:16:07 SAST */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa; /* Light grey background */
    color: #333;
    padding-top: 70px; /* Adjust if using a fixed navbar */
}

header h1 {
    color: #ffffff;
}

/* Loading Spinner Styles */
#loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050; /* Ensure it's above other content but below modals */
}


#index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Responsive grid */
    gap: 20px;
    padding: 20px;
}

.index-card {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow: hidden; /* Contain children */
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
     border: 1px solid #e0e0e0;
}

.index-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.index-card.pinned {
    /* Add styles for pinned cards - e.g., different background or border */
    border-left: 4px solid #0d6efd; /* Example: Blue border */
}


.card-header {
    background-color: #6c757d; /* Bootstrap secondary grey */
    color: white;
    padding: 10px 15px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab; /* Indicate draggable */
}
.card-header:active {
    cursor: grabbing;
}

.index-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
     flex-grow: 1; /* Allow name to take available space */
}

.card-actions button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 2px 5px;
    font-size: 1rem;
    margin-left: 5px;
    transition: color 0.2s ease;
}
.card-actions button:hover {
    color: white;
}
.card-actions .remove-btn:hover {
    color: #ffdddd; /* Light red hint on hover */
}
.card-actions .pin-btn:hover {
     color: #fff3cd; /* Light yellow hint on hover */
}


.card-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center align content */
    flex-grow: 1; /* Make body take remaining space */
}

.index-value {
    font-size: 2rem;
    font-weight: bold;
    color: #343a40; /* Dark grey */
    margin-bottom: 5px;
}

.index-change {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 15px;
}

.index-change.positive {
    color: #28a745; /* Bootstrap success green */
}

.index-change.negative {
    color: #dc3545; /* Bootstrap danger red */
}
.index-change.neutral {
    color: #6c757d; /* Bootstrap secondary grey */
}


.chart-container {
    width: 100%;
    height: 50px; /* Fixed height for sparkline */
    margin-top: auto; /* Push chart to bottom if content varies */
}

/* SortableJS helper classes */
.sortable-ghost {
    opacity: 0.4;
    background-color: #c8ebfb;
}
.sortable-chosen {
    /* Styles for the item being dragged - already handled by .sortable-drag */
}
.sortable-drag {
    opacity: 0.9; /* Make the dragged item slightly transparent */
     box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); /* More prominent shadow while dragging */
     transform: scale(1.02); /* Slightly enlarge */
}

/* Highlight class for newly added/existing items */
.index-card.highlight {
    transition: background-color 0.5s ease-out;
    background-color: #fff3cd; /* Bootstrap warning yellow background */
}


/* Modal search results */
#search-results {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
}
#search-results .list-group-item {
    cursor: pointer;
}
#search-results .list-group-item.active {
    /* Bootstrap handles active styling */
}

/* Stale data indicator (optional) */
.index-card.stale .card-body {
    opacity: 0.6;
}
.index-card.stale::after {
    content: "Stale";
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(255, 193, 7, 0.8); /* Warning yellow */
    color: #333;
    font-size: 0.7rem;
    padding: 1px 4px;
    border-radius: 3px;
}


/* Responsive adjustments */
@media (max-width: 768px) {
    #index-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        padding: 15px;
        gap: 15px;
    }
     body {
        padding-top: 60px;
    }
    .index-value {
        font-size: 1.8rem;
    }
    .index-change {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    #index-grid {
        grid-template-columns: 1fr; /* Single column on very small screens */
        padding: 10px;
        gap: 10px;
    }
     .card-header {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
     .index-value {
        font-size: 1.6rem;
    }
    .index-change {
        font-size: 0.95rem;
    }
}