/* Emoji font - ensures consistent rendering on Windows */
@font-face {
    font-family: 'Noto Color Emoji';
    src: url('/static/NotoColorEmoji.woff2') format('woff2');
    font-display: swap;
}

* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: #f0f0f0;
    text-align: center;
    padding: 1rem;
    font-size: clamp(0.875rem, 2.5vw, 1rem);
}

.card {
    background: white;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    vertical-align: middle;
}

.big-number {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    font-weight: bold;
    color: #2196F3;
    margin-top: 0.5rem;
}

.label {
    color: #666;
    margin-bottom: 0.5rem;
    font-size: clamp(0.75rem, 2.5vw, 0.875rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 100%;
}

th,
td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
    font-size: clamp(0.75rem, 2.5vw, 0.875rem);
    font-family: Arial, sans-serif;
}

/* ONLY apply emoji font to the Type column (center-aligned td with title attribute) */
td.center-align[title] {
    font-family: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
}

/* Apply emoji font to download link */
.download-link {
    font-family: Arial, sans-serif;
}

.download-link::before {
    font-family: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif;
}

.decimal-align {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.center-align {
    text-align: center;
}

.sound-toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: white;
    border: 0.125rem solid #e0e0e0;
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    z-index: 1000;
}

.sound-toggle:hover {
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

.sound-toggle.muted {
    background: #f8f9fa;
    opacity: 0.7;
}

.sound-toggle .icon {
    font-size: 1.5rem;
}

/* Toast notification for feedback */
.toast {
    position: fixed;
    bottom: 5rem;
    right: 1rem;
    background: #333;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    display: none;
    animation: slideIn 0.3s ease-out;
    z-index: 1001;
}

.toast.show {
    display: block;
}

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

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.high-moisture {
    color: #dc3545;
    font-weight: bold;
}

.good-moisture {
    color: #28a745;
    font-weight: 500;
}

.download-link {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.download-link:hover {
    background: #0056b3;
}

/* Mobile optimizations */
@media (max-width: 48rem) {
    body {
        padding: 0.5rem;
    }

    .card {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }

    th,
    td {
        padding: 0.375rem 0.25rem;
    }

    .table-container {
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
    }

    .status-bar {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 30rem) {
    .big-number {
        font-size: clamp(1.25rem, 5vw, 1.75rem);
    }
}

/* Status bar */
.status-bar {
    background: #f8f9fa;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: #6c757d;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #28a745;
    animation: pulse 2s infinite;
}

.status-dot.error {
    background: #dc3545;
    animation: none;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

/* Recent reading highlight */
.recent-reading {
    background: linear-gradient(90deg, #fff3cd 0%, #ffffff 100%);
    animation: fadeHighlight 3s ease-out;
}

@keyframes fadeHighlight {
    0% {
        background: #d1ecf1;
    }

    100% {
        background: linear-gradient(90deg, #fff3cd 0%, #ffffff 100%);
    }
}