/* Design system inspirado no padrão interno (Audires) usado nas demais aplicações da DScomm */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=Sometype+Mono:wght@400;500&display=swap');

:root {
    --brand-primary: #6647f0;
    --brand-primary-hover: #5533e0;
    --brand-primary-rgb: 102, 71, 240;
    --brand-secondary: #202020;
    --brand-accent: #0091ff;

    --app-bg: #F7F8FC;
    --surface: #ffffff;
    --text-primary: #111827;
    --text-secondary: #667085;
    --border-color: #E6EAF2;

    --radius-sm: 4px;
    --radius-md: 10px;
    --radius-card: 12px;
    --radius-button: 12px;
    --radius-lg: 16px;
    --radius-pill: 9999px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 8px 24px rgba(16, 24, 40, 0.04);
}

body {
    background-color: var(--app-bg);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    min-height: 100vh;
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #E6EAF2; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* Administrative layout structure */
.admin-shell { display: flex; min-height: 100vh; width: 100%; position: relative; }

.admin-sidebar {
    width: 264px;
    flex: 0 0 264px;
    height: 100vh;
    background-color: var(--surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 40;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-main {
    flex: 1;
    min-width: 0;
    padding-left: 264px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--app-bg);
    box-sizing: border-box;
}

.sidebar-active-indicator { position: relative; }
.sidebar-active-indicator::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 20px;
    background-color: var(--brand-primary);
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.sidebar-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 44px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.15s ease;
}
.sidebar-nav-link:hover { background-color: #f8f9fa; color: var(--text-primary); }
.sidebar-nav-link.active {
    background-color: rgba(var(--brand-primary-rgb), 0.06);
    color: var(--brand-primary);
    font-weight: 600;
}

.sidebar-group-title {
    padding: 0 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #a0aec0;
}

/* Expandable sidebar groups */
.sidebar-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 12px;
    margin: 0 0 8px;
    background: transparent;
    border: 0;
    cursor: pointer;
}
.sidebar-group-header:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; border-radius: 4px; }
.sidebar-group-header .sidebar-group-title { padding: 0; }
.sidebar-group-header .sidebar-group-chevron {
    font-size: 11px;
    color: #a0aec0;
    transition: transform 0.15s ease;
}
.sidebar-group-header[aria-expanded="true"] .sidebar-group-chevron { transform: rotate(90deg); }
.sidebar-group-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-group-nav.is-collapsed { display: none !important; }

/* The icon-rail (collapsed) desktop mode always shows every link regardless
   of each group's expand/collapse state - collapsing a group only makes
   sense when labels are visible to click a header, so this override keeps
   icon-only navigation working exactly as it did before groups existed. */
html.sidebar-collapsed .admin-sidebar .sidebar-group-header { display: none !important; }
html.sidebar-collapsed .admin-sidebar .sidebar-group-nav.is-collapsed { display: flex !important; }

.breadcrumb-premium {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 12px;
    color: var(--text-secondary);
}
.breadcrumb-premium-sep { display: flex; align-items: center; font-size: 10px; color: #cbd5e1; }

.admin-header {
    height: 72px;
    background-color: var(--surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 30;
}

/* Retractable sidebar (desktop) */
.sidebar-toggle-desktop {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}
.sidebar-toggle-desktop:hover { background-color: #f8f9fa; color: var(--text-primary); }

html.sidebar-collapsed .admin-sidebar { width: 76px; flex: 0 0 76px; }
html.sidebar-collapsed .admin-main { padding-left: 76px; }
html.sidebar-collapsed .admin-sidebar .sidebar-brand-text,
html.sidebar-collapsed .admin-sidebar .sidebar-group-title,
html.sidebar-collapsed .admin-sidebar .sidebar-nav-link span,
html.sidebar-collapsed .admin-sidebar .sidebar-user-info,
html.sidebar-collapsed .admin-sidebar .sidebar-logout-form { display: none !important; }
html.sidebar-collapsed .admin-sidebar .sidebar-nav-link { justify-content: center; padding: 0; }
html.sidebar-collapsed .admin-sidebar .sidebar-footer { justify-content: center; }
html.sidebar-collapsed .sidebar-toggle-desktop i { transform: rotate(180deg); }

.text-ui { font-family: 'Inter', system-ui, -apple-system, sans-serif; }
.text-mono { font-family: 'Sometype Mono', monospace; }

/* Premium cards */
.card-premium {
    background-color: var(--surface);
    border: 1px solid rgba(227, 232, 240, 0.7);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
}

/* Stat cards */
.stat-card {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    background-color: rgba(var(--brand-primary-rgb), 0.08);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.stat-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}
.stat-value { font-size: 24px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }

/* Form styling */
.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    display: block;
}
.input-premium, select.input-premium, textarea.input-premium {
    width: 100%;
    height: 42px;
    padding: 0 16px;
    border-radius: var(--radius-card);
    border: 1px solid var(--border-color);
    background-color: #fafbfc;
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.15s ease-in-out;
}
textarea.input-premium { height: auto; padding: 12px 16px; }
.input-premium:hover { border-color: #cbd5e1; background-color: #ffffff; }
.input-premium:focus {
    border-color: var(--brand-primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(var(--brand-primary-rgb), 0.12);
}
.input-premium.is-invalid { border-color: #e11d48; }

/* Buttons */
.btn-premium-primary {
    height: 42px;
    padding: 0 20px;
    border-radius: var(--radius-button);
    font-size: 14px;
    font-weight: 600;
    background-color: var(--brand-primary);
    color: #fff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn-premium-primary:hover { background-color: var(--brand-primary-hover); color: #fff; }
.btn-premium-secondary {
    height: 42px;
    padding: 0 20px;
    border-radius: var(--radius-button);
    font-size: 14px;
    font-weight: 600;
    background-color: #ffffff;
    color: var(--brand-secondary);
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.btn-premium-secondary:hover { background-color: #f8f9fa; border-color: #cbd5e1; color: var(--text-primary); }

/* Click-to-arm, click-again-to-confirm state for [data-confirm] buttons (see
   layouts/app.blade.php). !important on color: several of these buttons also
   carry Bootstrap's .text-danger utility (itself !important), which otherwise
   wins and leaves the armed "Confirmar?" text a barely-visible dark red on
   the red background instead of white. */
[data-confirm].is-confirm-armed,
[data-confirm].is-confirm-armed:hover {
    background-color: #e11d48;
    border-color: #e11d48;
    color: #fff !important;
}

/* Tables */
.table-premium-container {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.table-premium { width: 100%; border-collapse: collapse; font-family: 'Inter', system-ui, -apple-system, sans-serif; font-size: 13px; }
.table-premium th {
    padding: 14px 20px;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8793a8;
    background-color: #fafbfc;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
}
.table-premium td { padding: 14px 20px; border-bottom: 1px solid var(--border-color); color: #4a5568; vertical-align: middle; }
.table-premium tr:last-child td { border-bottom: none; }
.table-premium tr:hover td { background-color: #fafbfc; }

.filter-bar {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

/* Badges */
.badge-premium {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.badge-premium-success { background-color: rgba(22, 163, 106, 0.1); color: #16a36a; }
.badge-premium-danger { background-color: rgba(225, 29, 72, 0.1); color: #e11d48; }
.badge-premium-warning { background-color: rgba(217, 119, 6, 0.1); color: #d97706; }
.badge-premium-info { background-color: rgba(37, 99, 235, 0.1); color: #2563eb; }
.badge-premium-secondary { background-color: rgba(107, 114, 128, 0.1); color: #4b5563; }

.empty-state {
    text-align: center;
    padding: 60px 40px;
    background-color: var(--surface);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
}
.empty-state-icon { font-size: 48px; color: #cbd5e1; margin-bottom: 16px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.empty-state-description { font-size: 13px; color: var(--text-secondary); max-width: 400px; margin: 0 auto 20px; }

/* Auth pages */
body.auth-body {
    background-color: var(--app-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.auth-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border: 1px solid rgba(227, 232, 240, 0.7);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.05);
    padding: 40px;
}

/* Responsive side drawer on mobile */
@media (max-width: 1023px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { padding-left: 0 !important; }
    .sidebar-toggle-desktop { display: none !important; }
}

@media (min-width: 1024px) {
    .admin-sidebar { transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.2s ease; }
    .admin-main { transition: padding-left 0.2s ease; }
}

/* Busca Avançada — pressed-state buttons never rely on color alone (border + bold) */
.mode-btn.active, .source-btn.active, .depth-btn.active {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #fff;
    font-weight: 700;
}
.badge-premium .btn-close { width: .5em; height: .5em; background-size: .5em; padding: 0; opacity: .6; }
.badge-premium .btn-close:hover { opacity: 1; }
[data-tags-input] .input-premium { max-width: 100%; }
#cityResults:empty { display: none; }

/* Full-screen loading overlay for slow form posts (see data-loading in layouts/app) */
.loading-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(255, 255, 255, 0.75);
    display: flex; align-items: center; justify-content: center;
}
.loading-overlay.d-none { display: none !important; }
.loading-overlay-box {
    background: var(--surface); border: 1px solid var(--border-color);
    border-radius: 14px; padding: 28px 36px; text-align: center;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12); max-width: 360px;
}
