@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap');

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --text-color: #e2e8f0;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    width: 90%;
    max-width: 1000px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: var(--glass-border);
    border-radius: 16px;
    padding: 30px;
    margin-top: 50px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

h1 {
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: -0.5px;
}

/* Nav/Header */
.header-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: var(--danger);
    color: white;
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
}

th,
td {
    padding: 16px;
    text-align: left;
    border-bottom: var(--glass-border);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.05em;
}

td:first-child,
th:first-child {
    border-radius: 8px 0 0 8px;
}

td:last-child,
th:last-child {
    border-radius: 0 8px 8px 0;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.status-running {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

.status-stopped {
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Buttons */
button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    margin-right: 5px;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

button.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

button.btn-danger:hover {
    background: var(--danger);
    color: white;
}

button.btn-success {
    background: var(--success);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #1e293b;
    margin: 15% auto;
    padding: 30px;
    width: 400px;
    border-radius: 12px;
    text-align: center;
    border: var(--glass-border);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    color: white;
}

.progress-container {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    margin-top: 20px;
    overflow: hidden;
}

.progress-bar {
    height: 10px;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--success));
    border-radius: 20px;
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 15px;
    font-size: 0.9em;
    color: var(--text-muted);
}

/* Login Page */
.login-container {
    max-width: 400px;
    margin-top: 10%;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    outline: none;
    box-sizing: border-box;
    /* Fix padding issues */
}

.input-group input:focus {
    border-color: var(--primary-color);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        margin-top: 20px;
        width: 95%;
    }

    h1 {
        font-size: 1.5rem;
    }

    .header-actions {
        justify-content: center;
        margin-bottom: 25px;
    }

    /* Convert Table to Cards */
    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    /* Hide table headers (but not display: none;, for accessibility) */
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        border: var(--glass-border);
        border-radius: 12px;
        margin-bottom: 15px;
        padding: 10px;
        background: rgba(255, 255, 255, 0.02);
    }

    tr:hover td {
        background: transparent;
    }

    td {
        border: none;
        position: relative;
        padding-left: 50%;
        text-align: right;
        min-height: 25px;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        padding: 12px 10px;
    }

    td:first-child,
    td:last-child {
        border-radius: 0;
    }

    td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 0.85em;
    }

    /* Adjust buttons in the Actions cell */
    td[data-label="Ações"] {
        flex-direction: column;
        gap: 8px;
        padding-left: 10px;
        /* Reset padding for full width usage if needed */
        justify-content: center;
        text-align: center;
    }

    td[data-label="Ações"]::before {
        position: static;
        width: 100%;
        text-align: center;
        display: block;
        margin-bottom: 8px;
    }

    td[data-label="Ações"] button {
        width: 100%;
        margin-right: 0;
    }

    .login-container {
        margin-top: 20%;
    }
}