body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

header {
    background-color: #0056b3;
    color: #ffffff;
    padding: 1rem 0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
}

header p {
    margin: 0.5rem 0 0;
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    max-width: 1200px;
    margin: 15px auto; /* Slightly less margin on mobile */
    padding: 0 15px; /* Adjust padding for smaller screens */
    display: grid;
    grid-template-columns: 1fr; /* Default to single column for mobile */
    gap: 15px; /* Smaller gap for mobile */
}

section {
    background-color: #ffffff;
    padding: 15px; /* Adjust padding for smaller screens */
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

section h2 {
    color: #0056b3;
    margin-top: 0;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 8px; /* Adjust padding */
    margin-bottom: 15px; /* Adjust margin */
    font-size: 1.3rem; /* Adjust font size for mobile h2 */
}

/* Device Info Section */
#device-info p,
#battery-status p { /* Apply to both for consistency */
    font-size: 1rem; /* Adjust font size for mobile paragraphs */
    margin-bottom: 8px;
}

button {
    background-color: #28a745;
    color: white;
    padding: 12px 18px; /* Slightly larger padding for touch targets */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease;
    width: 100%; /* Make buttons full width on mobile by default */
    box-sizing: border-box; /* Include padding and border in the element's total width */
    margin-top: 10px; /* Add some margin between stacked buttons */
}

button:hover {
    background-color: #218838;
}

/* Impact Log Section */
#impact-log table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px; /* Adjust margin */
    font-size: 0.9rem; /* Smaller font for table content on mobile */
}

#impact-log th, #impact-log td {
    border: 1px solid #e0e0e0;
    padding: 8px; /* Adjust padding */
    text-align: left;
}

/* Responsive Design */
@media (min-width: 768px) {
    main {
        margin: 20px auto;
        padding: 0 20px;
        grid-template-columns: 1fr 1fr; /* Two columns on larger screens */
        gap: 20px;
    }

    section {
        padding: 20px;
    }

    section h2 {
        font-size: 1.5rem; /* Revert h2 font size for larger screens */
        padding-bottom: 10px;
        margin-bottom: 20px;
    }

    #device-info p,
    #battery-status p {
        font-size: 1.1rem; /* Revert paragraph font size for larger screens */
    }

    button {
        padding: 10px 15px; /* Revert button padding for larger screens */
        font-size: 1rem;
        width: auto; /* Revert button width */
        margin-top: 0; /* Remove top margin */
    }

    #impact-log table {
        margin-top: 15px;
        font-size: 1rem; /* Revert table font size for larger screens */
    }

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgb(0,0,0); /* Fallback color */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto; /* 15% from the top and centered */
    padding: 20px;
    border: 1px solid #888;
    width: 80%; /* Could be more or less, depending on screen size */
    max-width: 500px;
    border-radius: 10px;
    text-align: center;
}

.modal-buttons {
    margin: 20px 0;
}

.modal-buttons button {
    margin: 0 10px;
}

#custom-impact-label {
    width: calc(100% - 40px);
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 5px;
}

#save-impact-label {
    background-color: #007bff;
}

#save-impact-label:hover {
    background-color: #0056b3;
}

#dismiss-impact-label {
    background-color: #6c757d;
}

#dismiss-impact-label:hover {
    background-color: #5a6268;
}

/* Settings Section */
#settings {
    grid-column: span 1;
}

#settings strong {
    color: #004494;
}

/* Permissions Overlay Styles */
#permissions-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
}

.permissions-content {
    background-color: #333;
    padding: 30px;
    border-radius: 10px;
    max-width: 90%;
    width: 400px;
}

#request-permissions-btn {
    background-color: #28a745;
    font-size: 1.2rem;
    padding: 15px 20px;
}

#request-permissions-btn:hover {
    background-color: #218838;
}