:root {
    --primary: #3b82f6;
    /* Azul moderno (blue-500) */
    --primary-dark: #1d4ed8;
    /* Azul escuro (blue-700) */
    --secondary: #10b981;
    /* Verde esmeralda */
    --accent: #38bdf8;
    /* Azul-céu (acento) */
    --background: #0f172a;
    /* Fundo slate-900 (neutro profissional) */
    --surface: #1e293b;
    /* Cartões slate-800 */
    --surface-light: #334155;
    /* Inputs slate-700 */
    --text: #e2e8f0;
    /* Texto principal neutro (slate-200) */
    --text-muted: #94a3b8;
    /* Texto secundário (slate-400) */
    --border: #334155;
    /* Bordas slate-700 */
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.45);
    --radius: 10px;
    --radius-sm: 6px;
}

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

body {
    font-family: 'Inter', 'Roboto', system-ui, -apple-system, sans-serif;
    background-color: var(--background);
    background-image: radial-gradient(1200px 600px at 100% -10%, rgba(59, 130, 246, 0.08), transparent 60%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Ensure form elements inherit font */
input,
button,
select,
textarea,
.btn {
    font-family: inherit;
}

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

header {
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #ffffff;
    text-decoration: none;
}

.logo svg {
    width: 26px;
    height: 26px;
    color: var(--primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-sm);
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-links a svg {
    width: 17px;
    height: 17px;
    opacity: 0.85;
}

.nav-links a:hover {
    color: #ffffff;
    background: rgba(148, 163, 184, 0.12);
}

.nav-links a.active {
    color: #ffffff;
    background: rgba(59, 130, 246, 0.18);
}

.nav-links a.text-danger {
    color: #f87171;
}

.nav-links a.text-danger:hover {
    color: #fca5a5;
    background: rgba(248, 113, 113, 0.12);
}

/* Botão hambúrguer (mobile) */
.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    line-height: 0;
}

.nav-toggle svg {
    width: 22px;
    height: 22px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: #ffffff;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

/* Components */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.3rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.btn-edit {
    background-color: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.35rem 0.8rem;
    font-size: 0.83rem;
    border-radius: var(--radius-sm);
}

.btn-edit:hover {
    background-color: #3e4c63;
    transform: translateY(-1px);
}

.btn-delete {
    background-color: transparent;
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.4);
    padding: 0.35rem 0.8rem;
    font-size: 0.83rem;
    border-radius: var(--radius-sm);
}

.btn-delete:hover {
    background-color: rgba(248, 113, 113, 0.12);
    border-color: #f87171;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-muted);
    padding: 0.65rem 1.3rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--surface-light);
    color: var(--text);
    transform: translateY(-1px);
}

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

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

input,
select,
textarea {
    width: 100%;
    padding: 0.7rem 0.85rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input::placeholder,
textarea::placeholder {
    color: #64748b;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

thead {
    background-color: transparent;
}

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

th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    border-bottom: 2px solid var(--border);
    background-color: rgba(148, 163, 184, 0.05);
}

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.06);
}

tr:last-child td {
    border-bottom: none;
}

/* Utilities */
.text-center {
    text-align: center;
}

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

.text-danger {
    color: #f87171;
}

.mb-4 {
    margin-bottom: 1rem;
}

.w-full {
    width: 100%;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    text-align: left;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary), var(--accent));
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.flash-messages {
    position: fixed;
    top: 5rem;
    right: 2rem;
    z-index: 1000;
    max-width: 340px;
}

.alert {
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    color: var(--text);
    margin-bottom: 0.5rem;
    animation: slideIn 0.3s ease-out;
    box-shadow: var(--shadow-lg);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--surface-light);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.badge-admin {
    background-color: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.3);
}

.badge-user {
    background-color: rgba(148, 163, 184, 0.12);
    color: var(--text-muted);
    border-color: var(--border);
}

.status-confirmada {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.status-pendente {
    background: rgba(234, 179, 8, 0.15);
    color: #fde047;
    border: 1px solid rgba(234, 179, 8, 0.35);
}

.status-cancelada {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

@keyframes slideIn {
    from {
        transform: translateX(120%);
        opacity: 0;
    }

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

/* Responsivo — navegação mobile */
@media (max-width: 860px) {
    nav {
        padding: 0.8rem 1.2rem;
        flex-wrap: wrap;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 0.15rem;
        margin-top: 0.8rem;
    }

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

    .nav-links a {
        padding: 0.7rem 0.8rem;
        font-size: 1rem;
    }

    .container {
        padding: 1.25rem;
    }

    .flash-messages {
        right: 1rem;
        left: 1rem;
        max-width: none;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Tom Select Theme Overrides */
.ts-control {
    background: var(--surface-light) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text) !important;
    padding: 0.7rem 0.85rem !important;
    font-size: 0.95rem !important;
    box-shadow: none !important;
    font-family: inherit !important;
}

.ts-control.focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

.ts-dropdown {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-lg) !important;
    color: var(--text) !important;
    background: var(--surface) !important;
    font-family: inherit !important;
}

.ts-dropdown .active {
    background-color: var(--surface-light) !important;
    color: var(--text) !important;
}

.ts-control input {
    font-size: 0.95rem !important;
    color: var(--text) !important;
    font-family: inherit !important;
}

.ts-wrapper.single .ts-control:after {
    border-color: var(--text-muted) transparent transparent transparent !important;
}
