body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f9fafb;
    margin: 0;
    padding: 0;
}

.navbar {
    background-color: #1f2937;
    padding: 10px 20px;
    display: flex;
    align-items: center;
}

.navbar a, .navbar button {
    color: white;
    margin-right: 20px;
    text-decoration: none;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
}

.navbar a:hover, .navbar button:hover {
    text-decoration: underline;
}

h2, .page-title {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #111827;
    text-align: center;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    border-bottom: 1px solid #e5e7eb;
    padding: 10px;
    text-align: left;
}

button, .view-button {
    background-color: #3b82f6;
    color: white;
    padding: 5px 15px;
    margin: 4px 3px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    cursor: pointer;
}

button:hover, .view-button:hover {
    background-color: #2563eb;
}

.device-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
}

.card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    width: 100%;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    transition: transform 0.2s ease;
}

.card h3, .device-name {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}

.device-status {
    text-align: center;
    margin-bottom: 20px;
    font-size: 16px;
}

.relay-table {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.relay-row {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    padding: 8px;
    background-color: #f9fafb;
    border-radius: 8px;
}

.relay-status p {
    margin: 5px 0;
}

.online {
    color: #10b981;
    font-weight: bold;
}

.offline {
    color: #ef4444;
    font-weight: bold;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    width: 400px;
}

.save-button, .cancel-button {
    margin-top: 10px;
    margin-right: 10px;
    background-color: #3b82f6;
    color: white;
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.cancel-button {
    background-color: #6b7280;
}

.save-button:hover {
    background-color: #2563eb;
}

.cancel-button:hover {
    background-color: #4b5563;
}

.lights-status {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    margin: 10px 0 20px 0;
}

.light-on {
    color: #10b981;
}

.light-off {
    color: #ef4444;
}

.relay-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.toggle-button, .timer-button {
    width: 80%;
}

button:disabled, .timer-button:disabled {
    background-color: #d1d5db !important; /* Grey */
    cursor: not-allowed;
    color: #6b7280;
}

.timer-info {
    margin-top: 10px;
    font-size: 14px;
    color: #6b7280; 
    text-align: center;
}

.footer {
    text-align: center;
    padding: 20px;
    font-size: 14px;
    color: #6b7280;
    margin-top: 30px;
}
.footer a {
    color: #3b82f6;
    text-decoration: none;
}
.footer a:hover {
    text-decoration: underline;
}

.device-last-seen {
    text-align: center;
    margin-top: 8px;
    font-size: 0.9rem;
    color: #666;
}

.card-divider {
    margin: 10px auto;
    border: none;
    border-top: 1px solid #ddd;
    width: 80%;
}

.login-form {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.login-form input, .login-form select, .login-form textarea {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 1rem;
}

.pending {
    color: #f59e0b;
    font-weight: bold;
    font-size: 8pt;
}
.approved {
    color: #3b82f6;
    font-weight: bold;
}