/**
 * Octanis Sensor Dashboard - Custom Styles
 * Supplements Tailwind CSS with custom styling
 */

/* Sensor Cards */
.sensor-card {
    padding: 1rem;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    transition: all 0.3s ease;
}

.sensor-card:hover {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Connection Status Pulse Animation */
@keyframes pulse-green {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.bg-green-500 {
    animation: pulse-green 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Progress Bar Animation */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

#progress-bar-fill {
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 50%, #2563eb 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

/* Battery Bar Color Transitions */
#battery-bar {
    transition: width 0.3s ease, background-color 0.3s ease;
}

/* AQI Color Indicators */
.aqi-good {
    color: #10b981;
}

.aqi-moderate {
    color: #f59e0b;
}

.aqi-unhealthy-sensitive {
    color: #f97316;
}

.aqi-unhealthy {
    color: #ef4444;
}

.aqi-very-unhealthy {
    color: #9333ea;
}

.aqi-hazardous {
    color: #7c2d12;
}

/* Button Hover Effects */
button {
    transition: all 0.2s ease;
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Table Styling */
table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

table tbody tr {
    transition: background-color 0.15s ease;
}

/* Loading Spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    border: 2px solid #f3f4f6;
    border-top: 2px solid #2563eb;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#main-content {
    animation: fadeIn 0.5s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Responsive Font Sizes */
@media (max-width: 640px) {
    .sensor-card .text-2xl {
        font-size: 1.5rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1rem;
    }
}

/* Print Styles */
@media print {
    #connect-btn,
    #refresh-btn,
    #download-logs-btn,
    #export-csv-btn,
    #export-json-btn,
    #clear-logs-btn,
    #browser-warning,
    #instructions {
        display: none;
    }

    body {
        background: white;
    }

    .bg-white {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }

    table {
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /*
     * Uncomment to enable dark mode
     * Currently using Tailwind's default light theme
     */

    /*
    body {
        background-color: #111827;
        color: #f9fafb;
    }

    .bg-white {
        background-color: #1f2937;
    }

    .bg-gray-50 {
        background-color: #111827;
    }

    .text-gray-800 {
        color: #f9fafb;
    }

    .text-gray-600 {
        color: #d1d5db;
    }

    .sensor-card {
        background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    }

    .sensor-card:hover {
        background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
    }
    */
}

/* Accessibility Improvements */
button:focus-visible,
a:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* GPS Map Link Styling */
#gps-map-link {
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

#gps-map-link:hover {
    text-decoration: underline;
    gap: 0.5rem;
}

/* Download Progress Bar Container */
#download-progress-bar {
    transition: opacity 0.3s ease;
}

/* Status Indicator Glow Effect */
.bg-green-500.rounded-full {
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

/* Error and Success Message Styling (Future Enhancement) */
.toast-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

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

.toast-success {
    background-color: #10b981;
    color: white;
}

.toast-error {
    background-color: #ef4444;
    color: white;
}

/* Utility Classes */
.text-mono {
    font-family: 'Courier New', Courier, monospace;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
