/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f0f2f5;
    color: #1c1e21;
    line-height: 1.6;
}

/* ===== Login Page ===== */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1), 0 8px 16px rgba(0,0,0,0.1);
}

.login-container h2 {
    text-align: center;
    color: #1877f2;
    margin-bottom: 30px;
    font-size: 28px;
}

/* ===== Navigation ===== */
.navbar {
    background: #1877f2;
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-brand {
    font-size: 20px;
    font-weight: bold;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logout-btn {
    padding: 8px 16px;
    background: white;
    color: #1877f2;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: #e7f3ff;
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

/* ===== Cards ===== */
.card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.card h3 {
    margin-bottom: 20px;
    color: #1c1e21;
    font-size: 20px;
    border-bottom: 2px solid #e4e6eb;
    padding-bottom: 10px;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #606770;
}

input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    font-size: 16px;
    transition: border 0.3s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #1877f2;
    box-shadow: 0 0 0 2px #e7f3ff;
}

textarea {
    resize: vertical;
    min-height: 100px;
    font-family: monospace;
}

.hint {
    display: block;
    margin-top: 5px;
    color: #65676b;
    font-size: 12px;
}

/* ===== Buttons ===== */
.btn-primary {
    background: #1877f2;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s;
}

.btn-primary:hover:not(:disabled) {
    background: #166fe5;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-refresh {
    padding: 8px 16px;
    background: #e4e6eb;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-refresh:hover:not(:disabled) {
    background: #d8dadf;
}

.btn-refresh:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Status Badges ===== */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-processing {
    background: #cce5ff;
    color: #004085;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-failed {
    background: #f8d7da;
    color: #721c24;
}

/* ===== Messages ===== */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 5px;
    margin-top: 15px;
    text-align: center;
    border: 1px solid #c3e6cb;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #f5c6cb;
}

/* ===== Table ===== */
.table-responsive {
    overflow-x: auto;
    margin-top: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th {
    text-align: left;
    padding: 12px;
    background: #f5f6f7;
    color: #616770;
    font-weight: 600;
    font-size: 14px;
    border-bottom: 2px solid #dddfe2;
}

td {
    padding: 12px;
    border-bottom: 1px solid #e4e6eb;
    vertical-align: middle;
}

tr:hover {
    background: #f5f6f7;
}

/* ===== Text Utilities ===== */
.text-center {
    text-align: center;
}

.error {
    color: #dc3545;
}

/* ===== Loading Spinner ===== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1877f2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .navbar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .card {
        padding: 15px;
    }
    
    th, td {
        padding: 8px;
        font-size: 14px;
    }
}

/* ===== API Status ===== */
.api-status {
    background: #e3f2fd;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #1877f2;
}

/* ===== File Info ===== */
.file-info {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    margin-top: 20px;
    font-size: 12px;
    color: #666;
    border: 1px dashed #ddd;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: space-between;
}