body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f3f4f6;
    color: #1f2937;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.card {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    text-align: center;
    max-width: 400px;
    width: 100%;
    position: relative;
    border: 1px solid #e5e7eb;
}

h2 { margin-top: 0; color: #111; margin-bottom: 0.5rem; font-weight: 600; }
p { color: #6b7280; margin-bottom: 1.5rem; line-height: 1.6; }

.password-wrapper {
    width: 100%;
    margin-bottom: 24px;
}

.input-label {
    display: block;
    text-align: left;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
}

input[type="password"], input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    padding-right: 44px; /* Space for the toggle icon */
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 0.95rem;
    transition: all 0.2s;
    color: #111;
}

input[type="password"]:focus, input[type="text"]:focus {
    border-color: #3b82f6;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 4px;
    width: auto;
    font-size: 0.9rem;
    transition: color 0.2s;
}
.toggle-password:hover { color: #4b5563; }

.actions {
    display: flex;
    gap: 12px;
    width: 100%;
}

button {
    background-color: #2563eb;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    flex: 1;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px; /* Space between icon and text */
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
button:hover { background-color: #1d4ed8; transform: translateY(-1px); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
button:active { transform: translateY(0); }
button:disabled { background-color: #9ca3af; cursor: not-allowed; opacity: 0.7; transform: none; box-shadow: none; }

button.secondary {
    background-color: #fff;
    color: #374151;
    flex: 0 0 auto;
    border: 1px solid #d1d5db;
}
button.secondary:hover { background-color: #f9fafb; border-color: #9ca3af; color: #111; }

#status, #dash-status, #login-status {
    margin-top: 1rem;
    font-size: 0.9rem;
    text-align: left;
    padding: 10px;
    border-radius: 6px;
}
/* Ensure empty divs don't take space/padding if they have no class */
div:empty { display: none; }

.error {
    color: #991b1b;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    display: block !important;
}
.success {
    color: #065f46;
    background-color: #d1fae5;
    border: 1px solid #a7f3d0;
    display: block !important;
}

/* Spinner */
.spinner {
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top: 2px solid white;
    width: 14px;
    height: 14px;
    animation: spin 0.8s linear infinite;
    display: none;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dashboard Styles */
.dashboard-card {
    max-width: 1000px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 16px;
}
.header-row h2 {
    margin: 0;
    font-size: 1.5rem;
}

.small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Table Styles */
#data-preview-section {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden; /* Contains the scroll */
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: white;
}

th, td {
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 16px;
    text-align: left;
    white-space: nowrap;
}

th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

tr:nth-child(even) {
    background-color: #f8fafc;
}

tr:hover {
    background-color: #f1f5f9;
}

/* Column Configuration Styles */
#column-config-section {
    background-color: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.column-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 6px; /* Space for scrollbar */
    padding-bottom: 4px;
}

.column-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.column-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.column-item input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.95rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.col-btn {
    background: #fff;
    color: #4b5563;
    border: 1px solid #d1d5db;
    padding: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: 6px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}
.col-btn:hover { background: #f9fafb; color: #111; border-color: #9ca3af; }
.col-btn:disabled { opacity: 0.5; cursor: default; background: #f3f4f6; }

.col-btn.btn-danger {
    color: #ef4444;
    border-color: #fee2e2;
    background-color: #fef2f2;
}
.col-btn.btn-danger:hover {
    color: #b91c1c;
    background-color: #fee2e2;
    border-color: #fca5a5;
}

/* Scrollbar styling for webkit */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Media Queries */
@media (max-width: 640px) {
    .card {
        padding: 1.5rem;
    }

    .header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .header-row button {
        align-self: flex-end; /* Logout button */
    }

    .actions {
        flex-direction: column;
    }

    .column-item {
        flex-wrap: wrap;
    }
    .column-item input[type="text"] {
        min-width: 100%;
        margin-bottom: 8px;
    }
    .col-btn {
        flex: 1; /* Make buttons grow to fill space */
    }
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #3b82f6; /* Default blue */
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    animation: slideIn 0.3s ease-out forwards;
    opacity: 0;
    transform: translateX(100%);
    border-top: 1px solid #f3f4f6;
    border-right: 1px solid #f3f4f6;
    border-bottom: 1px solid #f3f4f6;
}

.toast.success {
    border-left-color: #10b981; /* Green */
}

.toast.error {
    border-left-color: #ef4444; /* Red */
}

.toast-icon {
    font-size: 1.2rem;
}
.toast.success .toast-icon { color: #10b981; }
.toast.error .toast-icon { color: #ef4444; }
.toast.info .toast-icon { color: #3b82f6; }

.toast-content {
    flex: 1;
    font-size: 0.95rem;
    color: #374151;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    font-size: 1.1rem;
    line-height: 1;
    transition: color 0.2s;
}
.toast-close:hover { color: #4b5563; }

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}
