:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --warning-color: #eab308;
    --font-main: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100%;
    z-index: 100;
    transition: width 0.3s ease;
}

.logo-area {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-logo {
    max-width: 100%;
    height: auto;
    max-height: 60px;
    /* Ajuste para não 'estourar' */
    object-fit: contain;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
    cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

.nav-link i {
    margin-right: 12px;
    font-size: 1.2rem;
}

.user-profile {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 1rem;
}

/* --- MAIN CONTENT --- */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 2.5rem;
    background-color: #0b1120;
}

/* --- LOGIN PAGE --- */
.login-body {
    background: radial-gradient(circle at top right, #1e293b 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
}

.login-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    padding: 3rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 420px;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    max-width: 200px;
    max-height: 80px;
    margin-bottom: 2rem;
    object-fit: contain;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: white;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* --- CARDS & GRID --- */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 5px 0;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* --- UPLOAD ZONE --- */
/* --- UPLOAD ZONE --- */
.upload-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    margin-bottom: 0;
    /* height: 100% removido para deixar natural */
}

/* ... (drop-zone and other classes remain same - simplified specifically for tool efficiently) ... */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    transition: 0.2s;
    background: rgba(15, 23, 42, 0.5);
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

.drop-icon {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 1rem;
    transition: color 0.2s;
}

.drop-zone:hover .drop-icon {
    color: var(--primary-color);
}

/* --- TERMINAL --- */
.terminal-card {
    background: #000;
    border-radius: 12px;
    border: 1px solid #333;
    overflow: hidden;
    /* height: handled by absolute pos */
    display: flex;
    flex-direction: column;
    font-family: 'JetBrains Mono', monospace;
}

.terminal-header {
    background: #111;
    padding: 10px 15px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #888;
}

.terminal-window {
    padding: 1rem;
    flex: 1;
    /* Cresce para ocupar todo o espaço restante */
    overflow-y: auto;
    /* Scroll apenas se necessário */
    height: 100%;
    /* Garante referência para o overflow funcionar */
    min-height: 0;
    /* Impede que o conteúdo force o crescimento do container */
    font-size: 0.9rem;
    color: #4ade80;
    line-height: 1.5;
}



/* --- BUTTONS --- */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(59, 130, 246, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid transparent;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger-color);
}

.btn-success {
    background: var(--success-color);
    color: #000;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

/* --- BADGES --- */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.badge-busy {
    background: rgba(234, 179, 8, 0.1);
    color: #eab308;
}

.badge-idle {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

/* --- FORMS --- */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(15, 23, 42, 0.8);
}

/* --- TABLES --- */
.table-responsive {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 220px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

/* Custom Scrollbar for Table */
.table-responsive::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Sticky Header */
.table th {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(5px);
    box-shadow: 0 1px 0 var(--border-color);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    text-align: left;
    padding: 14px 16px;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    background: rgba(30, 41, 59, 0.5);
    font-size: 0.9rem;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 0.95rem;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* --- UTILS --- */
.hidden {
    display: none !important;
}

.text-muted {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Modal Overlay */
.modal-overlay {
    animation: fadeIn 0.2s ease-out;
}

/* --- TOASTS --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    /* Allows clicking through the container */
}

.toast {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out forwards;
    pointer-events: auto;
    /* Re-enable clicks on the toast itself */
    max-width: 350px;
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-danger {
    border-left: 4px solid var(--danger-color);
}

.toast-warning {
    border-left: 4px solid var(--warning-color);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}