/* ============================================================
   SWGMA — Design System Global
   Base: dark glassmorphism, neon accents, Inter font
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--dark);
    color: var(--light);
    overflow-x: hidden;
    min-height: 100vh;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* ── CSS Variables ────────────────────────────────────────── */
:root {
    --primary:    #3b82f6;
    --secondary:  #0ea5e9;
    --accent:     #22c55e;
    --dark:       #09090b;
    --darker:     #040507;
    --light:      #f8fafc;
    --neon-blue:  #22d3ee;
    --neon-green: #34d399;

    --sidebar-w:  260px;
    --topbar-h:   64px;
    --radius-sm:  0.75rem;
    --radius-md:  1rem;
    --radius-lg:  1.5rem;
    --radius-xl:  2rem;

    --glass-bg:        linear-gradient(145deg, rgba(17,24,39,0.82), rgba(3,7,18,0.92));
    --glass-border:    1px solid rgba(56,189,248,0.12);
    --glass-blur:      blur(14px);

    --transition: 0.25s ease;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #020617; }
::-webkit-scrollbar-thumb { background: rgba(34,211,238,0.4); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(34,211,238,0.65); }

/* ── Links ────────────────────────────────────────────────── */
a { color: var(--neon-blue); text-decoration: none; transition: color var(--transition); }
a:hover { color: #67e8f9; }

/* ── Tipografia ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 { color: #ecfeff; line-height: 1.25; }
p { line-height: 1.65; color: #cbd5e1; }
small { color: #94a3b8; font-size: 0.82rem; }

.text-muted   { color: #64748b; }
.text-subtle  { color: #94a3b8; }
.text-body    { color: #cbd5e1; }
.text-light   { color: #f8fafc; }
.text-neon    { color: var(--neon-blue); }
.text-green   { color: var(--neon-green); }
.neon-text    { text-shadow: 0 0 8px rgba(34,211,238,0.28); }

.gradient-text {
    background: linear-gradient(90deg, #67e8f9, #93c5fd, #6ee7b7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Botões ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.2rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    border: none;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-primary {
    background: linear-gradient(90deg, #22d3ee, #3b82f6);
    color: #020617;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(34,211,238,0.22);
    color: #020617;
}

.btn-secondary {
    background: rgba(34,211,238,0.1);
    color: var(--neon-blue);
    border: 1px solid rgba(34,211,238,0.25);
}
.btn-secondary:hover {
    background: rgba(34,211,238,0.18);
    border-color: rgba(34,211,238,0.5);
    color: #67e8f9;
}

.btn-outline {
    background: transparent;
    color: #cbd5e1;
    border: 1px solid rgba(148,163,184,0.3);
}
.btn-outline:hover {
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}

.btn-danger {
    background: rgba(239,68,68,0.12);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover {
    background: rgba(239,68,68,0.22);
    border-color: #f87171;
}

.btn-ghost {
    background: transparent;
    color: #94a3b8;
    border: none;
}
.btn-ghost:hover { color: #f8fafc; background: rgba(255,255,255,0.05); }

.btn-sm { padding: 0.35rem 0.9rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; }
.btn-icon {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    justify-content: center;
    border-radius: 0.65rem;
}
.btn-icon.btn-sm { width: 1.85rem; height: 1.85rem; }

/* Spinner no botão */
.btn.loading::after {
    content: "";
    width: 0.9em;
    height: 0.9em;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}

/* ── Cards / Glassmorphism ────────────────────────────────── */
.card {
    background: var(--glass-bg);
    border: var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.card-sm  { padding: 1rem;  border-radius: var(--radius-md); }
.card-lg  { padding: 2rem;  border-radius: var(--radius-xl); }

.card-hover {
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.card-hover:hover {
    transform: translateY(-4px);
    border-color: rgba(34,211,238,0.35);
    box-shadow: 0 16px 34px rgba(34,211,238,0.1);
}

/* ── Inputs / Form Fields ─────────────────────────────────── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-control {
    width: 100%;
    padding: 0.65rem 1rem;
    background: rgba(15,23,42,0.7);
    border: 1px solid rgba(148,163,184,0.18);
    border-radius: var(--radius-sm);
    color: #f8fafc;
    font-size: 0.92rem;
    font-family: 'Inter', sans-serif;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-control::placeholder { color: #475569; }
.form-control:focus {
    border-color: rgba(34,211,238,0.5);
    box-shadow: 0 0 0 3px rgba(34,211,238,0.1);
}
.form-control:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

textarea.form-control { resize: vertical; min-height: 90px; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.1rem;
    padding-right: 2.5rem;
    cursor: pointer;
}
select.form-control option { background: #0f172a; }

.form-hint { font-size: 0.78rem; color: #64748b; margin-top: 0.2rem; }
.form-error { font-size: 0.78rem; color: #f87171; margin-top: 0.2rem; }
.form-control.is-invalid { border-color: rgba(239,68,68,0.5); }

/* Input com ícone */
.input-group {
    position: relative;
    display: flex;
    align-items: center;
}
.input-group .input-icon {
    position: absolute;
    left: 0.85rem;
    color: #475569;
    font-size: 0.9rem;
    pointer-events: none;
    transition: color var(--transition);
}
.input-group .form-control { padding-left: 2.5rem; }
.input-group .form-control:focus + .input-icon,
.input-group:focus-within .input-icon { color: var(--neon-blue); }

/* Toggle / Switch */
.form-switch {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
}
.form-switch input[type="checkbox"] { display: none; }
.form-switch .switch-track {
    width: 2.4rem;
    height: 1.3rem;
    border-radius: 999px;
    background: rgba(148,163,184,0.2);
    border: 1px solid rgba(148,163,184,0.2);
    position: relative;
    transition: background var(--transition), border-color var(--transition);
    flex-shrink: 0;
}
.form-switch .switch-track::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 0.9rem; height: 0.9rem;
    border-radius: 50%;
    background: #64748b;
    transition: transform var(--transition), background var(--transition);
}
.form-switch input:checked ~ .switch-track {
    background: rgba(34,211,238,0.2);
    border-color: rgba(34,211,238,0.5);
}
.form-switch input:checked ~ .switch-track::after {
    transform: translateX(1.1rem);
    background: var(--neon-blue);
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.badge-success   { background: rgba(52,211,153,0.12); color: #34d399; border: 1px solid rgba(52,211,153,0.22); }
.badge-warning   { background: rgba(251,191,36,0.12); color: #fbbf24; border: 1px solid rgba(251,191,36,0.22); }
.badge-danger    { background: rgba(239,68,68,0.12);  color: #f87171; border: 1px solid rgba(239,68,68,0.22); }
.badge-info      { background: rgba(34,211,238,0.12); color: #22d3ee; border: 1px solid rgba(34,211,238,0.22); }
.badge-secondary { background: rgba(148,163,184,0.1); color: #94a3b8; border: 1px solid rgba(148,163,184,0.18); }
.badge-primary   { background: rgba(59,130,246,0.12); color: #93c5fd; border: 1px solid rgba(59,130,246,0.22); }

.badge-dot::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Avatar ───────────────────────────────────────────────── */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
    user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-xs  { width: 1.75rem; height: 1.75rem; font-size: 0.6rem; }
.avatar-sm  { width: 2.25rem; height: 2.25rem; font-size: 0.75rem; }
.avatar-md  { width: 2.75rem; height: 2.75rem; font-size: 0.88rem; }
.avatar-lg  { width: 3.5rem;  height: 3.5rem;  font-size: 1.1rem; }
.avatar-xl  { width: 5rem;    height: 5rem;    font-size: 1.5rem; }

/* ── Funcionário Badge (avatar + nome + subtítulo) ─────────── */
.func-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    max-width: 100%;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}
.func-badge-inline { vertical-align: middle; }
a.func-badge:hover .func-badge-nome { color: var(--accent-cyan, #22d3ee); }
.func-badge-text {
    display: inline-flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
}
.func-badge-nome {
    font-weight: 600;
    color: var(--text-primary, #f1f5f9);
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.func-badge-sub {
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.05rem;
}

/* ── Tabela ───────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid rgba(56,189,248,0.1);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    background: rgba(15,23,42,0.6);
    border-bottom: 1px solid rgba(56,189,248,0.1);
    white-space: nowrap;
}

.table tbody td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(148,163,184,0.06);
    color: #cbd5e1;
    vertical-align: middle;
}

.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: rgba(34,211,238,0.04); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Alertas ──────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    line-height: 1.5;
}

.alert-success  { background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.2); color: #a7f3d0; }
.alert-warning  { background: rgba(251,191,36,0.1); border: 1px solid rgba(251,191,36,0.2); color: #fde68a; }
.alert-danger   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.2);  color: #fca5a5; }
.alert-info     { background: rgba(34,211,238,0.08); border: 1px solid rgba(34,211,238,0.18); color: #a5f3fc; }

/* ── Toast ────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background: linear-gradient(145deg, rgba(17,24,39,0.98), rgba(3,7,18,0.98));
    border: 1px solid rgba(56,189,248,0.18);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    min-width: 280px;
    max-width: 400px;
    pointer-events: all;
    animation: toastIn 0.3s ease forwards;
    color: #f8fafc;
}
.toast.removing { animation: toastOut 0.25s ease forwards; }
.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-msg  { flex: 1; line-height: 1.4; }
.toast-close { background: none; border: none; color: #64748b; cursor: pointer; font-size: 0.9rem; padding: 0; flex-shrink: 0; }
.toast-close:hover { color: #f8fafc; }

.toast-success .toast-icon { color: var(--neon-green); }
.toast-warning .toast-icon { color: #fbbf24; }
.toast-danger  .toast-icon { color: #f87171; }
.toast-info    .toast-icon { color: var(--neon-blue); }

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2,6,23,0.75);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    backdrop-filter: blur(4px);
}
.modal-backdrop.open { display: flex; }

.modal-dialog {
    background: linear-gradient(145deg, rgba(17,24,39,0.97), rgba(3,7,18,0.98));
    border: 1px solid rgba(56,189,248,0.15);
    border-radius: var(--radius-xl);
    width: min(560px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 70px rgba(2,6,23,0.6);
    animation: modalIn 0.25s ease forwards;
    position: relative;
}
.modal-dialog.modal-lg { width: min(800px, 100%); }
.modal-dialog.modal-sm { width: min(400px, 100%); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(148,163,184,0.1);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 600; color: #ecfeff; }

.modal-body    { padding: 1.5rem; }
.modal-footer  {
    display: flex;
    gap: 0.65rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(148,163,184,0.1);
}

.modal-close {
    width: 2rem; height: 2rem;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.18);
    background: rgba(15,23,42,0.8);
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    transition: color var(--transition), border-color var(--transition);
}
.modal-close:hover { color: #f8fafc; border-color: rgba(239,68,68,0.4); }

/* ── Dropdown ─────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    min-width: 180px;
    background: linear-gradient(145deg, rgba(17,24,39,0.98), rgba(3,7,18,0.98));
    border: 1px solid rgba(56,189,248,0.15);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 36px rgba(0,0,0,0.45);
    z-index: 500;
    padding: 0.4rem;
    animation: fadeDown 0.18s ease forwards;
}
.dropdown-menu.open { display: block; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    color: #cbd5e1;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
}
.dropdown-item:hover { background: rgba(34,211,238,0.07); color: #f8fafc; }
.dropdown-item.danger:hover { background: rgba(239,68,68,0.1); color: #f87171; }
.dropdown-divider { height: 1px; background: rgba(148,163,184,0.1); margin: 0.3rem 0; }

/* ── Skeleton Loader ──────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg,
        rgba(255,255,255,0.04) 25%,
        rgba(255,255,255,0.08) 50%,
        rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
}

/* ── Animations ───────────────────────────────────────────── */
.fade-in {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

.pulse-dot { animation: pulseGlow 1.8s ease-in-out infinite; }

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(103,232,249,0.5); opacity: 1; }
    50% { box-shadow: 0 0 0 8px rgba(103,232,249,0); opacity: 0.7; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(20px); }
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Utility Classes ──────────────────────────────────────── */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(56,189,248,0.2), transparent);
    margin: 1rem 0;
}

.section-tag {
    display: inline-block;
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: #67e8f9;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3.5rem 2rem;
    gap: .75rem;
}
.empty-state i {
    font-size: 2.4rem;
    color: #334155;
    margin-bottom: .25rem;
    display: block;
}
.empty-state p {
    color: #94a3b8;
    font-size: .9rem;
    margin: 0;
    line-height: 1.5;
}
.empty-state h4 {
    color: #94a3b8;
    font-size: .95rem;
    font-weight: 500;
    margin: 0;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #ecfeff;
}
.page-subtitle { font-size: 0.88rem; color: #64748b; margin-top: 0.2rem; }

/* ── Glow on hover (botão especial) ──────────────────────── */
.glow-on-hover {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.glow-on-hover::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        rgba(34,211,238,0.35),
        rgba(59,130,246,0.35),
        rgba(52,211,153,0.35));
    opacity: 0;
    transition: opacity 0.3s ease;
}
.glow-on-hover:hover { transform: translateY(-1px); box-shadow: 0 18px 40px rgba(34,211,238,0.18); }
.glow-on-hover:hover::before { opacity: 1; }
.glow-on-hover > * { position: relative; z-index: 1; }
