:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f3f4f6;
    --surface: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --danger: #ef4444;
    --success: #10b981;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-main);
}

p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

/* Navbar */
nav {
    background: var(--surface);
    padding: 1rem 0;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

nav .nav-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-header {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-toggle {
    display: none;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: var(--primary);
    font-weight: 600;
    border-radius: 8px;
    padding: 0.45rem 0.8rem;
    cursor: pointer;
}

.nav-toggle:hover {
    background: #e0e7ff;
}

nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--primary);
}

/* Cards & Forms */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

input,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    background-color: #f9fafb;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
    background-color: var(--surface);
}

/* Buttons */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-hover);
}

.btn-primary:disabled {
    background-color: #a5b4fc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
    color: var(--text-main);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* Alerts / Flashes */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #e0e7ff;
    color: var(--primary);
}

.badge-blue {
    background-color: #dbeafe;
    color: #1d4ed8;
}

.badge-green {
    background-color: #d1fae5;
    color: #065f46;
}

/* Vagas Status Info */
#status-vagas {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

/* Grid Styles for Spreadsheet view */
.escala-grid {
    border: 1px solid #000;
}

.escala-grid th,
.escala-grid td {
    border: 1px solid #777;
    padding: 0.5rem;
    white-space: nowrap;
}

.escala-grid thead th {
    background-color: transparent;
    color: #000;
    text-transform: uppercase;
}

.escala-grid .text-center {
    text-align: center;
}

.escala-grid .border-right {
    border-right: 2px solid #444;
}

.escala-grid .font-weight-bold {
    font-weight: 700;
    color: #000;
}

.escala-grid .area-header td {
    background-color: #f9f9f9;
    padding: 1rem 0.5rem;
    border-top: 3px solid var(--primary);
}

.bg-manha {
    background-color: #c9daf8;
}

.bg-noite {
    background-color: #fce5cd;
}

.th-manha {
    background-color: #a4c2f4;
    color: #000 !important;
}

.th-noite {
    background-color: #f9cb9c;
    color: #000 !important;
}

.cell-responsavel {
    background-color: #a4c2f4;
    /* Darker blue for morning responsavel */
}

.bg-noite.cell-responsavel {
    background-color: #f9cb9c;
    /* Darker orange for night responsavel */
}

.cell-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.btn-remove-micro {
    background: transparent;
    border: none;
    color: var(--danger);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    border-radius: 4px;
}

.btn-remove-micro:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-20px);
    transition: all 0.2s;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.search-results {
    position: absolute;
    width: 100%;
    background: white;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: #f9fafb;
}

.input-container {
    position: relative;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    nav .nav-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .nav-header {
        justify-content: space-between;
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        gap: 0.25rem;
        border-top: 1px solid var(--border);
        padding-top: 0.5rem;
    }

    .nav-links.is-open {
        display: flex;
    }

    nav a {
        padding: 0.35rem 0;
    }
}