/* --- Global Styles & Variables --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap'); /* Modern Font */

:root {
    --bg-primary: #121212; /* Slightly softer black */
    --bg-secondary: #1e1e1e; /* Dark grey for elements */
    --bg-tertiary: #2c2c2e; /* Lighter grey for sections */
    --text-primary: #e0e0e0; /* Off-white */
    --text-secondary: #a0a0a0; /* Medium grey */
    --text-tertiary: #707070; /* Darker grey */
    --accent-blue: #0A84FF; /* Vibrant iOS Blue */
    --accent-green: #30D158; /* Vibrant iOS Green */
    --accent-red: #FF453A; /* Vibrant iOS Red */
    --border-color: #3a3a3c;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
    /* --shadow-color: rgba(0, 0, 0, 0.3); /* Removed as less relevant */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family);
}

html {
    height: 100%; /* Ensure html takes full height */
}

body {
    min-height: 100vh; /* Use viewport height */
    background-color: var(--bg-primary); /* App background covers everything */
    color: var(--text-primary);
    overscroll-behavior-y: contain; /* Prevent pull-to-refresh */
    display: flex; /* Prepare body for flex */
    flex-direction: column; /* Stack app container */
}

/* --- App Container (Now Fullscreen) --- */
.app-container {
    width: 100%;
    flex-grow: 1; /* Allow container to grow and fill body */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Still useful for modals etc. */
    /* REMOVED: max-width, min-height (body handles height), border-radius, box-shadow, background-color (body has it) */
}

.page {
    flex-grow: 1; /* Allow page to fill container */
    padding: 20px; /* Side padding */
    padding-top: 0; /* Headers will handle top padding */
    padding-bottom: 50px; /* Space at bottom */
    overflow-y: auto; /* Enable scrolling within the page */
    display: flex;
    flex-direction: column;
}


/* --- Desktop Notice Styling --- */
#desktopNotice {
    display: none; /* Hidden by default (on mobile) */
    /* Styles below apply ONLY when shown via media query */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 40px;
    background-color: #f0f0f0; /* Light background for notice */
    color: #333; /* Dark text for notice */
    height: 100vh; /* Full viewport height */
}

.notice-content {
    max-width: 500px;
}

.notice-icon {
    font-size: 60px;
    color: #555;
    margin-bottom: 30px;
}

#desktopNotice h2 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #333; /* Override default h2 color */
}

#desktopNotice p {
    font-size: 16px;
    color: #666; /* Override default p color */
    line-height: 1.6;
}


/* --- Typography --- */
h1 {
    font-size: 26px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-primary);
}

h2 { /* Used for device name in settings */
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

h3 { /* Used for Section Headers */
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 25px;
    margin-bottom: 10px;
    padding-left: 15px; /* Indent section headers */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.5;
    text-align: center;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
}
a:hover {
    text-decoration: underline;
}

/* --- Buttons --- */
.btn {
    display: flex; /* Use flex for icon alignment */
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px;
    margin-bottom: 15px;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    text-align: center;
}
.btn:active {
    transform: scale(0.98); /* Subtle press effect */
}

.primary-btn {
    background-color: var(--accent-blue);
    color: white;
}
.primary-btn:hover {
    background-color: #0073e6; /* Slightly darker blue on hover */
}

.google-btn {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.google-btn:hover {
    background-color: var(--bg-tertiary);
}
.google-icon { /* If using SVG */
    width: 20px;
    height: 20px;
    margin-right: 12px;
}
.google-icon-fa { /* If using FontAwesome */
     margin-right: 12px;
     font-size: 18px;
     color: #db4437; /* Keep Google red */
}

.danger-btn {
    background-color: transparent; /* Make disconnect less prominent */
    color: var(--accent-red);
    text-align: center;
    width: 100%;
    padding: 15px 0;
    font-weight: 500;
}
.danger-btn:hover {
    background-color: rgba(255, 69, 58, 0.1); /* Subtle red background on hover */
}

.btn-icon { /* For header back/close buttons */
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 10px; /* Make clickable area larger */
    line-height: 1;
    border-radius: 50%;
    width: 40px; /* Fixed size */
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s ease;
}
.btn-icon:hover {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}
.header-spacer { /* To balance icons in headers */
    width: 40px;
    height: 40px;
}

/* --- Login Page --- */
.login-header {
    text-align: center;
    padding: 60px 0 30px 0; /* More top padding */
}
.logo-icon {
    font-size: 48px;
    color: var(--accent-blue);
    margin-bottom: 20px;
}
.login-header p {
    font-size: 16px;
    color: var(--text-secondary);
}

.form-container {
    padding: 0 20px; /* Consistent padding */
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}
.input-group .input-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 16px;
}

#loginPage input[type="email"],
#loginPage input[type="password"] {
    width: 100%;
    padding: 16px 16px 16px 50px; /* Add left padding for icon */
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.2s ease;
}
#loginPage input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background-color: var(--bg-tertiary);
}
#loginPage input::placeholder {
    color: var(--text-tertiary);
}

.divider {
    width: 100%;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    line-height: 0.1em;
    margin: 25px 0;
}
.divider span {
    background: var(--bg-primary); /* Match page background */
    padding: 0 12px;
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.signup-link {
    margin-top: 30px;
    padding-bottom: 30px; /* Add padding at the end of the form */
    font-size: 14px;
    color: var(--text-secondary);
}

/* --- Scan Page --- */
.scan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 15px; /* Adjust padding slightly */
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px; /* Space below header */
}
.scan-header h1 {
    margin-bottom: 0; /* Remove bottom margin */
    font-size: 18px; /* Smaller header title */
    font-weight: 600;
}
.back-btn { /* Style for the back button */
     margin-right: 10px; /* Space between button and title */
}

.scanner-visualizer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 40px 0;
    min-height: 180px; /* Ensure space for animation */
}

.radar {
    position: relative;
    width: 150px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.radar-icon {
    font-size: 30px;
    color: var(--accent-blue);
    z-index: 2;
}

.radar-wave {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(10, 132, 255, 0.5); /* Use accent blue with opacity */
    border-radius: 50%;
    animation: radarPulse 2.5s infinite ease-out;
    opacity: 0;
}

.radar-wave:nth-child(2) {
    animation-delay: 0.8s;
}
.radar-wave:nth-child(3) {
    animation-delay: 1.6s;
}

@keyframes radarPulse {
    0% {
        transform: scale(0.1);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: scale(1.2);
        opacity: 0;
    }
}

.scan-status-text {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.device-list-container {
    padding: 0 15px; /* Consistent padding */
    width: 100%; /* Ensure it takes full width */
}

/* --- Device Card Styles (Updated) --- */
.device-card {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: 18px; /* Slightly adjusted padding */
    display: flex;
    align-items: center; /* Vertically align items */
    margin-bottom: 15px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    border: 1px solid transparent;
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0;
    width: 100%; /* Ensure card takes full width of container */
    overflow: hidden; /* Prevent content spilling */
}
.device-card:hover {
    background-color: var(--bg-tertiary);
    transform: translateY(-3px);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.device-card img {
    width: 45px; /* Slightly smaller image */
    height: 45px;
    object-fit: contain;
    margin-right: 15px; /* Adjust spacing */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    flex-shrink: 0; /* Prevent image from shrinking */
}

.device-info {
    flex-grow: 1; /* Allow this div to take remaining space */
    min-width: 0; /* Important for flex items to prevent overflow */
    display: flex;          /* Use flex for vertical alignment */
    flex-direction: column; /* Stack h3 and p vertically */
    justify-content: center;/* Center vertically if needed, depends on img height */
}

.device-info h3 { /* Device Name */
    font-size: 16px; /* Slightly smaller font */
    font-weight: 600;
    margin: 0 0 4px 0; /* Reset margin, add bottom margin */
    color: var(--text-primary);
    text-align: left;
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden;    /* Hide overflow */
    text-overflow: ellipsis; /* Add ellipsis (...) if too long */
}

.device-info p { /* Device Status */
    font-size: 14px;
    color: var(--text-secondary);
    text-align: left;
    margin-left: 15px;   /* Reset margin */
    white-space: nowrap; /* Prevent wrapping */
    overflow: hidden;    /* Hide overflow */
    text-overflow: ellipsis; /* Add ellipsis (...) if too long */
}
/* --- End Device Card Styles --- */


/* --- Settings Page --- */
.settings-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 15px; /* Consistent padding */
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px; /* Space before device display */
}
.settings-main-header h1 {
     margin-bottom: 0;
     font-size: 18px;
     font-weight: 600;
}

.settings-device-display {
    text-align: center;
    padding: 20px 0;
    position: relative; /* For positioning elements if needed */
    margin-bottom: 20px; /* Space below device display */
}

.earbuds-display {
    position: relative;
    width: 180px; /* Adjust container size */
    height: 80px; /* Adjust container size */
    margin: 0 auto 15px auto; /* Center and add space below */
    /* background-color: #444; /* Debugging */
}

.earbud-img {
    position: absolute;
    width: 90px; /* Adjust size */
    height: auto;
    bottom: 0;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4)); /* Enhance shadow */
    transition: transform 0.3s ease;
}

.earbud-left {
    left: 0;
    transform: rotate(-20deg) translateX(-5px); /* Adjust rotation/position */
}

.earbud-right {
    right: 0;
    transform: scaleX(-1) rotate(-20deg) translateX(-5px); /* Flip horizontally and adjust */
}
.settings-device-display h2 { /* Device name styling */
    margin-bottom: 8px;
}
.battery-status {
    font-size: 14px;
    color: var(--accent-green); /* Green for battery */
    font-weight: 500;
}
.battery-status i {
    margin-right: 5px;
    vertical-align: middle;
}


.settings-section {
    margin-bottom: 15px;
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    overflow: hidden; /* Clip items inside rounded corners */
    margin-left: 15px; /* Add side margin to sections */
    margin-right: 15px; /* Add side margin to sections */
}
.settings-section h3 {
    padding-top: 15px; /* Add padding above title within section */
    margin-top: 0; /* Remove default margin */
     padding-left: 20px; /* Consistent padding */
     padding-bottom: 5px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px; /* Consistent padding */
    font-size: 16px;
    color: var(--text-primary);
    background-color: var(--bg-secondary); /* Ensure item bg matches section */
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.15s ease;
}
.settings-section .settings-item:last-child {
    border-bottom: none;
}

.settings-item label:not(.switch) { /* Target the text label */
    flex-grow: 1;
    margin-right: 15px;
    font-weight: 500; /* Slightly bolder text */
}

.settings-item.interactive {
    cursor: pointer;
}
.settings-item.interactive:hover {
    background-color: var(--bg-tertiary);
}

.setting-value {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    font-weight: 500;
}
.setting-value i.fa-chevron-right {
    margin-left: 10px;
    font-size: 14px;
    color: var(--text-tertiary); /* Darker chevron */
}

/* --- Toggle Switch (iOS Style) --- */
.switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0; /* Prevent shrinking */
}
.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-tertiary); /* Off state */
  transition: .3s;
}
.slider:before {
  position: absolute;
  content: "";
  height: 27px; width: 27px;
  left: 2px; bottom: 2px;
  background-color: white;
  transition: .3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
input:checked + .slider { background-color: var(--accent-green); } /* Use vibrant green */
input:checked + .slider:before { transform: translateX(20px); }
.slider.round { border-radius: 31px; }
.slider.round:before { border-radius: 50%; }


/* --- EQ Modal --- */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000; /* High z-index */
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.6); /* Darker backdrop */
    justify-content: center;
    align-items: flex-end; /* Align modal to bottom */
    opacity: 0; /* Start hidden for transition */
    transition: opacity 0.3s ease;
    padding: 0; /* Remove padding here for full width */
}
.modal.show { /* Class to show modal */
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--bg-tertiary); /* Slightly lighter than section */
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0; /* Round top corners */
    width: 100%; /* Full width */
    max-width: none; /* Remove max-width for full screen */
    color: var(--text-primary);
    padding: 15px 15px 20px 15px;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.2);
    transform: translateY(100%); /* Start off-screen */
    transition: transform 0.3s ease-out;
}
.modal.show .modal-content {
    transform: translateY(0); /* Slide in */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    text-align: left; /* Align title left */
    margin: 0;
}
.close-modal-btn { /* Specific styling for close button */
    color: var(--text-secondary);
}

.modal-content ul {
    list-style: none;
    padding: 0;
    margin-bottom: 10px; /* Space before potential footer/button */
}
.modal-content li {
    display: flex; /* Align icon and text */
    align-items: center;
    padding: 16px;
    margin-bottom: 8px;
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-weight: 500;
}
.modal-content li:last-child {
    margin-bottom: 0;
}
.modal-content li:hover {
    background-color: rgba(255, 255, 255, 0.1); /* Subtle white hover */
}
.modal-content li .icon {
    margin-right: 15px;
    width: 20px; /* Fixed width for alignment */
    text-align: center;
    color: var(--text-secondary); /* Icon color */
    font-size: 18px;
}
.modal-content li[data-eq="Custom"] .icon { color: var(--accent-blue); } /* Example: Color custom icon */

/* Ensure button inside section takes full width */
.settings-section .btn {
    width: calc(100% - 40px); /* Account for item padding (20px each side) */
    margin: 15px 20px; /* Match item padding */
}


/* --- Media Query for Desktop --- */
@media (min-width: 768px) { /* Adjust breakpoint as needed (e.g., 600px, 768px, 992px) */
    body {
        /* Keep body styles simple for centering the notice */
        background-color: #f0f0f0; /* Set light background for the notice page */
        display: flex; /* Override mobile flex settings */
        flex-direction: row; /* Reset flex direction */
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        color: #333; /* Reset text color for notice */
    }

    .app-container {
        display: none; /* Hide the entire app UI on desktop */
    }

    #desktopNotice {
        display: flex; /* Show the notice on desktop */
        /* Height/width/centering handled by body flex settings now */
         background-color: #f0f0f0; /* Ensure notice bg matches body */
    }
}