/* General Styles */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f4f4f9, #e0e0e7);
    color: #333;
    transition: background 0.3s ease, color 0.3s ease;
}

body.dark-mode {
    background: linear-gradient(135deg, #222, #444);
    color: #eee;
}

.container {
    max-width: 800px;
    margin: 50px auto;
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: background 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Glowing Effect on Container Sides */
.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 123, 255, 0.5), transparent);
    animation: glow 4s infinite;
}

@keyframes glow {
    0% {
        left: -100%;
    }
    50% {
        left: 100%;
    }
    100% {
        left: -100%;
    }
}

body.dark-mode .container {
    background: rgba(0, 0, 0, 0.8);
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #007bff;
}

/* Buttons */
button {
    margin: 10px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 123, 255, 0.5), transparent);
    transition: left 0.5s ease;
}

button:hover::before {
    left: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
}

.btn-dark {
    background: linear-gradient(135deg, #333, #555);
    color: white;
}

/* Test Area */
#test-area {
    margin-top: 20px;
}

.results {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
}

.result-box {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.result-box:hover {
    transform: translateY(-5px);
}

.result-box p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

.result-box span {
    font-size: 24px;
    font-weight: bold;
    color: #007bff;
}

/* Graph */
#graph-container {
    position: relative;
    margin-top: 20px;
    width: 100%;
    height: 300px;
    background: #222;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #444;
}

#graph {
    display: flex;
    align-items: flex-end;
    height: 100%;
}

.bar {
    width: 4px;
    margin-right: 1px;
    background: linear-gradient(to top, #0f9, #ff4500);
    transition: height 0.1s ease-in-out, background 0.3s ease;
}

.bar:hover::after {
    content: attr(data-rate) " Hz";
    position: absolute;
    top: -20px;
    left: -10px;
    background: #333;
    color: #fff;
    padding: 3px 5px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
}

#line-chart {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Badges */
#badges {
    margin-top: 20px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    padding: 20px;
    border-radius: 10px;
    display: none;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

#badge-text {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

/* Dark Mode Adjustments */
body.dark-mode .result-box {
    background: rgba(0, 0, 0, 0.8);
    color: #eee;
}

body.dark-mode .result-box p {
    color: #aaa;
}

body.dark-mode .result-box span {
    color: #0f9;
}

body.dark-mode #badges {
    background: #555;
    border-color: #999;
    color: #eee;
}