body {
    font-family: sans-serif;
    line-height: 1.6;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 20px auto;
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1, h2 {
    color: #2c3e50;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

h1 {
    text-align: center;
}

.card {
    background-color: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.08);
}

.settings-box {
    background-color: #fdfdfd;
    border: 1px solid #e0e0e0;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"] {
    width: calc(100% - 20px); /* Account for padding */
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #777;
}

button {
    background-color: #3498db;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #2980b9;
}

.delete-button {
    background-color: #e74c3c;
    padding: 5px 10px;
    font-size: 0.85rem;
    margin-left: 10px;
    float: right; /* Position delete button nicely */
}

.delete-button:hover {
    background-color: #c0392b;
}

#load-more-button {
     background-color: #2ecc71;
}
#load-more-button:hover {
    background-color: #27ae60;
}
#load-more-button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

.error {
    color: #e74c3c;
    background-color: #fdd;
    border: 1px solid #e74c3c;
    padding: 10px;
    margin-top: 15px;
    border-radius: 4px;
}

.success {
    color: #2ecc71;
    background-color: #e0f8e0;
    border: 1px solid #2ecc71;
    padding: 10px;
    margin-top: 15px;
    border-radius: 4px;
}

#email-list {
    margin-top: 30px;
}

#emails-container p {
    color: #777;
    text-align: center;
}

.email-item {
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    margin-bottom: 15px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden; /* Contain floated elements like delete button */
}

.email-header {
    background-color: #ecf0f1;
    padding: 10px 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer; /* Indicate body is expandable (though not implemented here) */
}

.email-header strong {
    font-size: 1.1em;
    color: #34495e;
}

.email-meta {
    display: block;
    font-size: 0.85em;
    color: #7f8c8d;
    margin-top: 5px;
}

.email-body {
    padding: 15px;
    /* max-height: 400px; /* Limit body height initially if needed */
    /* overflow-y: auto; */ /* Add scroll if content exceeds max-height */
    border-top: 1px solid #eee; /* Add separation if header doesn't have bottom border */
}

.email-body iframe {
    width: 100%;
    border: none;
    min-height: 150px; /* Start height for iframe */
    display: block; /* Ensure iframe takes full width */
}
/* Attempt to auto-height iframe (might require JS) */
/* iframe { object-fit: contain; } */


.email-body pre {
    white-space: pre-wrap;       /* CSS3 */
    white-space: -moz-pre-wrap;  /* Mozilla */
    white-space: -pre-wrap;      /* Opera 4-6 */
    white-space: -o-pre-wrap;    /* Opera 7 */
    word-wrap: break-word;       /* Internet Explorer 5.5+ */
    font-family: monospace;
    background-color: #f9f9f9;
    padding: 10px;
    border: 1px dashed #ddd;
    max-height: 400px;
    overflow-y: auto;
}

.attachments-list {
    padding: 10px 15px;
    background-color: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    font-size: 0.9em;
}

.attachments-list ul {
    list-style: none;
    padding: 0;
    margin: 5px 0 0 0;
}

.attachments-list li {
    margin-bottom: 5px;
}

.attachments-list a {
    color: #3498db;
    text-decoration: none;
}

.attachments-list a:hover {
    text-decoration: underline;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    margin-top: 15px;
    color: #555;
}

.spinner {
    border: 4px solid #f3f3f3; /* Light grey */
    border-top: 4px solid #3498db; /* Blue */
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .container {
        padding: 15px;
    }
    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"],
    .form-group input[type="number"] {
        width: calc(100% - 16px); /* Adjust padding */
        padding: 8px;
    }
    button {
        padding: 8px 15px;
        font-size: 0.95rem;
    }
    .delete-button {
         float: none;
         display: block;
         margin-top: 10px;
         margin-left: 0;
         text-align: center;
    }
    .email-header {
        padding: 8px 10px;
    }
     .email-body {
        padding: 10px;
    }
    .attachments-list {
        padding: 8px 10px;
    }
}