body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

header {
    background-color: #004d40; /* Dark Teal */
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
}

nav button {
    background-color: #00796b; /* Medium Teal */
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    margin-left: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease;
}

nav button:hover {
    background-color: #00897b; /* Lighter Teal */
}

main {
    padding: 2rem;
    max-width: 900px; /* Adjusted for better auth card centering */
    margin: 20px auto;
    background-color: transparent; /* Main content background is transparent now */
    border-radius: 8px;
    /* box-shadow: 0 0 10px rgba(0,0,0,0.05); */ /* Removed from main, added to auth-card */
}

section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 1px solid #eee;
    border-radius: 8px;
    background-color: #fafafa;
}

/* NEW: Auth Card Styling */
.auth-card {
    max-width: 400px;
    margin: 3rem auto; /* Center the card */
    padding: 2.5rem;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    text-align: center; /* Center title and switch links */
}

.auth-card h2 {
    color: #004d40;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    border-bottom: none; /* Remove border from H2 in card */
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem; /* Increase gap for better spacing */
    margin-bottom: 1.5rem;
}

.auth-card form label {
    font-weight: bold;
    margin-bottom: 0.2rem;
    text-align: left; /* Align labels left within the form */
}

/* --- ADJUSTED FOR CONSISTENT INPUT WIDTHS --- */
.auth-card form input[type="email"],
.auth-card form input[type="password"] {
    width: 100%; /* Make them take full width of their parent */
    padding: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    margin: 0; /* Remove auto margin */
    box-sizing: border-box; /* Crucial: padding and border are included in width */
    margin-bottom: 1.2rem; /* Consistent bottom margin for fields not in containers */
}

/* Override general margin-bottom for password container input */
.password-input-container input {
    margin-bottom: 0; /* Input inside container doesn't need its own bottom margin */
}

/* Password Input Container for Eye Icon */
.password-input-container {
    position: relative;
    width: 100%; /* Take full width */
    box-sizing: border-box; /* Include padding in width */
    margin-bottom: 1.2rem; /* Consistent bottom margin for the container */
}

/* Adjust the input inside the container to make space for the icon */
.password-input-container input {
    /* This input already gets width: 100% from above general rule */
    padding-right: 40px; /* Space for the icon */
    /* No need for width: calc(100% - Xpx) anymore due to box-sizing and padding-right */
}


.password-toggle-icon {
    position: absolute;
    right: 10px; /* Position relative to the container's right edge */
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #555;
    font-size: 1.2em; /* Adjust size as needed */
    z-index: 10; /* Ensure icon is above input */
}

.password-toggle-icon:hover {
    color: #333;
}
/* --- END ADJUSTED FOR CONSISTENT INPUT WIDTHS --- */


.auth-card form button {
    background-color: #26a69a; /* Greenish Teal */
    color: white;
    border: none;
    padding: 0.9rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease;
    width: 100%;
    margin-top: 1rem;
}

.auth-card form button:hover {
    background-color: #2bbd9a; /* Lighter Greenish Teal */
}

.auth-switch {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: #666;
}

.auth-switch a {
    color: #00796b;
    text-decoration: none;
    font-weight: bold;
}

.auth-switch a:hover {
    text-decoration: underline;
}
/* END NEW: Auth Card Styling */


h2, h3 {
    color: #004d40;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.5rem;
    margin-top: 0;
}

.form-container { /* This class is no longer directly used in auth-section */
    background-color: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.02);
    margin-top: 1rem;
}

.error-message {
    color: #d32f2f; /* Red */
    background-color: #ffebee;
    border: 1px solid #ef9a9a;
    padding: 0.5rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    text-align: left; /* Ensure error messages align left */
}

#api-key-list, #api-usage-stats, .api-test-interface {
    margin-top: 1.5rem;
    border-top: 1px dashed #e0e0e0;
    padding-top: 1.5rem;
}

#api-key-list p, #api-usage-stats p {
    font-size: 0.95rem;
    line-height: 1.6;
}

#generate-new-key-button {
    background-color: #ffa000; /* Amber */
    color: white;
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 1rem;
    transition: background-color 0.2s ease;
}
#generate-new-key-button:hover {
    background-color: #ffb300;
}

.api-test-interface select,
.api-test-interface textarea,
.api-test-interface button {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.api-test-interface textarea {
    min-height: 150px;
    font-family: 'Courier New', Courier, monospace;
}

#api-response {
    background-color: #e8eaf6; /* Light Indigo */
    padding: 15px;
    border-radius: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', Courier, monospace;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #c5cae9;
}

footer {
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
    background-color: #eeeeee;
    color: #666;
    font-size: 0.9rem;
    border-top: 1px solid #e0e0e0;
}

#api-key-list ul {
    list-style-type: none;
    padding: 0;
}

#api-key-list li {
    background-color: #e0f2f1; /* Light cyan background */
    border: 1px solid #b2dfdb;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#api-key-list li strong {
    color: #004d40; /* Dark Teal */
}

#api-key-list li code {
    background-color: #cfd8dc; /* Light blue-grey */
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    word-break: break-all; /* Ensure long keys wrap */
}

.secret-key-warning {
    color: #d32f2f; /* Red */
    font-weight: bold;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: #ffebee; /* Light red background */
    border-left: 5px solid #d32f2f;
    border-radius: 4px;
}

nav button.header-nav-button { /* New style for the SDK/Docs buttons */
    background-color: #00796b; /* Medium Teal */
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    margin-left: 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease;
}

nav button.header-nav-button:hover {
    background-color: #00897b; /* Lighter Teal */
}

/* Style for code blocks in documentation */
pre.code-block {
    background-color: #e0e0e0; /* Light gray */
    color: #333;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto; /* Enable horizontal scrolling for long lines */
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    line-height: 1.4;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

pre.code-block code {
    white-space: pre; /* Preserve whitespace inside code tag */
}

/* List styling for better docs readability */
section#docs-section ul, section#docs-section ol {
    margin-left: 1.5rem;
    padding-left: 0;
    margin-bottom: 1rem;
}

section#docs-section li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* Spinner Styles */
.spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid #3498db; /* Blue spinner */
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block; /* Aligns with button text if present */
    vertical-align: middle;
    margin-left: 10px; /* Space between button and spinner */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


.password-toggle-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #555;
    font-size: 1.2em; /* Adjust size as needed */
    z-index: 10; /* Ensure icon is above input */
}

.password-toggle-icon:hover {
    color: #333;
}

/* Billing Button Styles */
.billing-button-primary {
    background-color: #007bff; /* A nice primary blue */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin-right: 10px;
    margin-bottom: 10px; /* Add some space if buttons wrap */
    transition: background-color 0.3s ease;
}

.billing-button-primary:hover {
    background-color: #0056b3;
}

.billing-button-secondary {
    background-color: #6c757d; /* A secondary grey */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    margin-bottom: 10px;
    transition: background-color 0.3s ease;
}

.billing-button-secondary:hover {
    background-color: #5a6268;
}

/* Plan Button Styles (within Upgrade Options) */
.plan-button {
    padding: 8px 15px;
    border-radius: 4px;
    border: 1px solid #ccc;
    background-color: #f8f9fa;
    cursor: pointer;
    margin-right: 8px;
    margin-bottom: 8px;
    font-size: 0.9em;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.plan-button:hover {
    background-color: #e2e6ea;
    border-color: #adadad;
}

/* Specific Plan Colors */
.basic-plan-button {
    background-color: #28a745; /* Success green */
    color: white;
    border-color: #28a745;
}

.basic-plan-button:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.pro-plan-button {
    background-color: #ffc107; /* Warning yellow/orange */
    color: #343a40; /* Dark text for contrast */
    border-color: #ffc107;
}

.pro-plan-button:hover {
    background-color: #e0a800;
    border-color: #d39e00;
}

/* 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: rgba(0,0,0,0.6); /* Black w/ opacity */
    padding-top: 60px;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto; /* 5% from the top and centered */
    padding: 30px;
    border: 1px solid #888;
    width: 90%; /* Could be more responsive */
    max-width: 1000px; /* Max width */
    border-radius: 8px;
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.plan-cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.plan-card {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    flex: 1 1 300px; /* Allow cards to grow/shrink, minimum 300px width */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.plan-card h3 {
    font-size: 1.8em;
    margin-top: 0;
    color: #34495e;
}

.plan-card .price {
    font-size: 2.5em;
    font-weight: bold;
    color: #2c3e50;
    margin: 15px 0;
}

.plan-card ul {
    list-style: none;
    padding: 0;
    text-align: left;
    margin-bottom: 20px;
    flex-grow: 1; /* Allow ul to take up available space */
}

.plan-card li {
    margin-bottom: 10px;
    padding-left: 25px;
    position: relative;
    color: #555;
}

.plan-card li::before {
    content: '✓'; /* Checkmark icon */
    color: #28a745; /* Green checkmark */
    position: absolute;
    left: 0;
    top: 0;
    font-weight: bold;
}

.plan-card .plan-button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.3s ease;
    width: 100%; /* Full width button */
}

.plan-card .plan-button:hover:not(:disabled) {
    background-color: #2188c7;
}

.plan-card .plan-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.spark-card {
    background-color: #e8f5e9; /* Light green */
    border-color: #81c784;
}

.spark-card .plan-button {
    background-color: #6c757d; /* Grey for disabled/current */
    cursor: not-allowed;
}

.plan-note {
    text-align: center;
    margin-top: 30px;
    font-size: 0.9em;
    color: #777;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }
    .plan-cards-container {
        flex-direction: column;
        align-items: center;
    }
    .plan-card {
        flex: 1 1 90%; /* Take up more width on smaller screens */
        max-width: 350px; /* Max width for single column */
    }
}

/* Basic Spinner CSS */
.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;
    display: inline-block; /* Or block, depending on desired layout */
    vertical-align: middle; /* Align with text */
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
