/**
 * Custom styles for Povodni mož (River monitoring application)
 * Color scheme: Soft teal
 * Font: Nerd Font Meslo
 */

/* Watery font for titles */
.watery-title {
    font-family: 'Fredoka One', cursive !important;
    text-shadow: 2px 2px 4px rgba(0, 139, 139, 0.3);
    color: var(--teal-primary) !important;
}

.navbar-brand .watery-title {
    color: white !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Global font family override - exclude icons and watery titles */
body, h2, h3, h4, h5, h6, p, span, div, a, button, input, select, textarea, label, .btn, .form-control, .form-select {
    font-family: 'MesloLGLNerdFontMono-Regular', 'Meslo LG L', 'Meslo LG', monospace !important;
}

/* Preserve Font Awesome icons */
.fas, .far, .fab, .fal, .fad, .fa {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro", "Font Awesome 6 Brands" !important;
}

/* Custom CSS Variables for Teal Theme */
:root {
    --teal-primary: #008b8b;
    --teal-secondary: #20b2aa;
    --teal-light: #40e0d0;
    --teal-dark: #006666;
    --teal-muted: #5f9ea0;
}

/* Logo styling */
.logo-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.header-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.brand-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: white !important;
}

/* Override Bootstrap primary color with teal */
.bg-primary {
    background-color: var(--teal-primary) !important;
}

.text-primary {
    color: var(--teal-primary) !important;
}

.btn-primary {
    background-color: var(--teal-primary);
    border-color: var(--teal-primary);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--teal-dark);
    border-color: var(--teal-dark);
}

.btn-outline-primary {
    color: var(--teal-primary);
    border-color: var(--teal-primary);
}

.btn-outline-primary:hover, .btn-outline-primary:focus {
    background-color: var(--teal-primary);
    border-color: var(--teal-primary);
}

.badge.bg-primary {
    background-color: var(--teal-primary) !important;
}

/* Additional teal theme elements */
.form-select:focus, .form-control:focus {
    border-color: var(--teal-light);
    box-shadow: 0 0 0 0.25rem rgba(64, 224, 208, 0.25);
}

.navbar-dark .navbar-brand:hover {
    color: var(--teal-light) !important;
}

.badge.bg-success {
    background-color: var(--teal-secondary) !important;
}

.badge.bg-warning {
    background-color: var(--teal-muted) !important;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
}

/* Chart legend colors - override for teal theme */
.chart-legend .bg-primary {
    background-color: var(--teal-primary) !important;
}

/* Metric display styles */
.metric {
    padding: 0.5rem 0;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--teal-primary);
}

/* Vertical metrics layout */
.metrics-vertical {
    padding: 1rem;
}

.metric-item {
    text-align: center;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background-color: rgba(0, 139, 139, 0.1);
    border-left: 4px solid var(--teal-primary);
}

.metric-item .metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--teal-primary);
    margin-bottom: 0.25rem;
}

.metric-item .metric-label {
    font-size: 0.875rem;
    color: var(--bs-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Compact layout styles */
.compact-card {
    margin-bottom: 1rem;
    height: 500px;
}

.compact-header {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--teal-primary), var(--teal-secondary));
}

.location-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.temperature-value {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
}

.compact-body {
    padding: 0;
    height: calc(100% - 50px);
}

/* Vertical sections layout */
.vertical-sections {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.data-section {
    flex: 1;
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 139, 139, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.data-section:last-child {
    border-bottom: none;
}

/* With only 2 sections, make them equal height */
.data-section {
    min-height: calc(50% - 0.5px);
}

.data-section.active {
    background: linear-gradient(135deg, rgba(0, 139, 139, 0.05), rgba(0, 139, 139, 0.02));
    border-left: 4px solid var(--teal-primary);
}

.data-section:hover {
    background: rgba(0, 139, 139, 0.03);
    transform: translateX(5px);
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
}

.section-header i {
    font-size: 1.1rem;
    margin-right: 0.5rem;
    color: var(--teal-primary);
}

.section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--teal-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--teal-primary);
    margin-bottom: 0.25rem;
}

.section-chart {
    height: calc(100% - 80px);
    min-height: 140px;
    transition: opacity 0.3s ease;
}

/* Specific section colors */
.water-section.active {
    border-left-color: #008b8b;
}

.water-section .section-header i,
.water-section .section-value {
    color: #008b8b;
}

.temperature-section.active {
    border-left-color: #ff6b6b;
}

.temperature-section .section-header i,
.temperature-section .section-value {
    color: #ff6b6b;
}

.flow-section.active {
    border-left-color: #4ecdc4;
}

.flow-section .section-header i,
.flow-section .section-value {
    color: #4ecdc4;
}

/* Card improvements for vertical layout */
.card {
    border: 1px solid rgba(0, 139, 139, 0.2);
    box-shadow: 0 0.25rem 0.75rem rgba(0, 139, 139, 0.1);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 0.5rem 1.5rem rgba(0, 139, 139, 0.2);
    transform: translateY(-2px);
}

.card-header {
    background: linear-gradient(135deg, var(--teal-primary), var(--teal-secondary));
    color: white;
    border-bottom: none;
}

.card-header h5 {
    color: white !important;
    margin: 0;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .metrics-vertical {
        padding: 0.5rem;
    }
    
    .metric-item {
        margin-bottom: 0.75rem;
        padding: 0.5rem;
    }
    
    .metric-item .metric-value {
        font-size: 1.25rem;
    }
    
    .compact-card {
        height: 400px;
    }
    
    .data-section {
        padding: 0.75rem;
    }
    
    .section-chart {
        height: calc(100% - 60px);
        min-height: 100px;
    }
    
    .section-value {
        font-size: 1.2rem;
    }
}

.metric-label {
    font-size: 0.875rem;
    color: var(--bs-secondary);
    margin-top: 0.25rem;
}

/* Card enhancements */
.card {
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: var(--bs-light);
    border-bottom: 1px solid var(--bs-border-color);
}

/* Chart container */
canvas {
    max-height: 200px;
}

/* Loading spinner */
#loadingSpinner {
    display: none;
    text-align: center;
    padding: 2rem;
}

/* Status indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .metric-value {
        font-size: 1rem;
    }
    
    .metric-label {
        font-size: 0.75rem;
    }
    
    .card-body .row.text-center > .col-4 {
        margin-bottom: 1rem;
    }
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
    .card {
        background-color: var(--bs-dark);
        border-color: var(--bs-gray-700);
    }
    
    .card-header {
        background-color: var(--bs-gray-800);
        border-bottom-color: var(--bs-gray-700);
    }
}

/* Utility classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Loading states */
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Alert customizations */
.alert {
    border: none;
    border-radius: 0.5rem;
}

/* Header styling */
.navbar-brand {
    font-weight: 600;
}

/* Footer */
.footer {
    margin-top: auto;
    background: linear-gradient(135deg, var(--teal-primary), var(--teal-secondary)) !important;
    border-top: 3px solid var(--teal-light);
    box-shadow: 0 -4px 6px rgba(0, 139, 139, 0.1);
}

.footer h5 {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.footer a:hover {
    color: var(--teal-light) !important;
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

.footer .fas.fa-database {
    opacity: 0.9;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.footer .fas.fa-external-link-alt {
    transition: transform 0.3s ease;
}

.footer a:hover .fas.fa-external-link-alt {
    transform: translateX(2px) translateY(-1px);
}

/* Final visual optimizations */
.card-title {
    color: white !important;
    font-weight: 600;
}

.compact-card {
    border: 1px solid rgba(0, 139, 139, 0.3);
    box-shadow: 0 0.15rem 0.5rem rgba(0, 139, 139, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.compact-card:hover {
    box-shadow: 0 0.3rem 1rem rgba(0, 139, 139, 0.2);
    transform: translateY(-1px);
}

.btn-group-sm .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.2rem;
}

.chart-btn {
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.chart-btn.active {
    box-shadow: 0 0 0 0.2rem rgba(0, 139, 139, 0.25);
    transform: scale(1.02);
}

/* Performance optimizations */
.chart-container-compact canvas {
    transition: opacity 0.3s ease;
}

/* Smooth loading states */
.loading-shimmer {
    background: linear-gradient(90deg, rgba(0, 139, 139, 0.1) 25%, rgba(0, 139, 139, 0.2) 50%, rgba(0, 139, 139, 0.1) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
    color: var(--bs-secondary);
}
