/**
 * Stronghold Tracker - Custom Styles
 * Dark theme with Bootstrap 5
 */

/* ========================================
   Root Variables
   ======================================== */
:root {
    --st-bg-primary: #1a1a2e;
    --st-bg-secondary: #16213e;
    --st-bg-tertiary: #0f3460;
    --st-accent: #e94560;
    --st-text-primary: #eaeaea;
    --st-text-muted: #a0a0a0;
    --st-border: #2d2d44;
    --st-success: #6bcb77;
    --st-warning: #ffd93d;
    --st-info: #4ecdc4;
    --st-danger: #ff6b6b;
}

/* ========================================
   Base Styles
   ======================================== */
body {
    background-color: var(--st-bg-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* ========================================
   Cards & Containers
   ======================================== */
.card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.world-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.card-header {
    font-weight: 500;
}

/* ========================================
   Map Container
   ======================================== */
.map-container {
    position: relative;
    width: 100%;
    height: 500px;
    background-color: var(--st-bg-primary);
    overflow: hidden;
    cursor: grab;
}

.map-container:active {
    cursor: grabbing;
}

#stronghold-map {
    width: 100%;
    height: 100%;
    display: block;
}

/* ========================================
   Legend
   ======================================== */
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

/* ========================================
   Tables
   ======================================== */
.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: var(--st-border) transparent;
}

.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: transparent;
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: var(--st-border);
    border-radius: 4px;
}

.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--st-text-muted);
}

.table-sm td,
.table-sm th {
    padding: 0.4rem 0.5rem;
}

.sticky-top {
    background-color: #212529 !important;
    z-index: 10;
}

/* ========================================
   Buttons
   ======================================== */
.btn-group-sm .btn {
    padding: 0.25rem 0.5rem;
}

/* ========================================
   Forms
   ======================================== */
.form-control:focus,
.form-select:focus {
    border-color: var(--st-accent);
    box-shadow: 0 0 0 0.2rem rgba(233, 69, 96, 0.25);
}

.form-control::placeholder {
    color: var(--st-text-muted);
    opacity: 0.7;
}

/* ========================================
   Badges
   ======================================== */
.badge {
    font-weight: 500;
}

/* ========================================
   Modals
   ======================================== */
.modal-content {
    border: 1px solid var(--st-border);
}

/* ========================================
   Alerts
   ======================================== */
.alert {
    border: none;
}

/* ========================================
   Footer
   ======================================== */
.footer {
    margin-top: auto;
}

/* ========================================
   Utility Classes
   ======================================== */
.text-accent {
    color: var(--st-accent) !important;
}

.bg-body-tertiary {
    background-color: var(--st-bg-secondary) !important;
}

/* ========================================
   Prediction Table Row Styles
   ======================================== */
.prediction-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.prediction-row:hover {
    background-color: rgba(78, 205, 196, 0.1) !important;
}

.prediction-row.found {
    background-color: rgba(107, 203, 119, 0.1) !important;
}

.prediction-row.found:hover {
    background-color: rgba(107, 203, 119, 0.2) !important;
}

/* ========================================
   Slot Info Modal
   ======================================== */
#slotInfoBody .info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

#slotInfoBody .info-item {
    padding: 0.5rem;
    background: var(--st-bg-secondary);
    border-radius: 4px;
}

#slotInfoBody .info-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--st-text-muted);
    margin-bottom: 0.25rem;
}

#slotInfoBody .info-item value {
    display: block;
    font-weight: 500;
}

/* ========================================
   Loading States
   ======================================== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--st-border);
    border-top-color: var(--st-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   Responsive Adjustments
   ======================================== */
@media (max-width: 991.98px) {
    .map-container {
        height: 400px;
    }
}

@media (max-width: 767.98px) {
    .map-container {
        height: 350px;
    }
    
    .card-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-group-sm {
        flex-wrap: wrap;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .navbar,
    .footer,
    .btn,
    form {
        display: none !important;
    }
    
    .card {
        break-inside: avoid;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1100;
}

.toast {
    background-color: var(--st-bg-secondary);
    border: 1px solid var(--st-border);
}

/* ========================================
   Coordinate Display
   ======================================== */
.coord-display {
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
}

/* ========================================
   Ring Color Indicators
   ======================================== */
.ring-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.ring-indicator.ring-1 { background-color: #4ecdc4; }
.ring-indicator.ring-2 { background-color: #45b7d1; }
.ring-indicator.ring-3 { background-color: #96ceb4; }
.ring-indicator.ring-4 { background-color: #ffeaa7; }
.ring-indicator.ring-5 { background-color: #dfe6e9; }

/* ========================================
   Hover tooltips
   ======================================== */
[title] {
    cursor: help;
}

/* ========================================
   Animation Classes
   ======================================== */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
