/* =============================================================
   ORC PIGPINS — app.css
   Sistema de Orçamentos — Bootstrap 4 custom theme
   ============================================================= */

/* -----------------------------------------------
   Variables / tokens
   ----------------------------------------------- */
:root {
    --orc-sidebar-width: 240px;
    --orc-sidebar-collapsed-width: 60px;
    --orc-sidebar-bg: #1e2235;
    --orc-sidebar-text: #a8aeca;
    --orc-sidebar-text-active: #ffffff;
    --orc-sidebar-active-bg: rgba(255, 255, 255, 0.08);
    --orc-sidebar-brand-color: #ffffff;
    --orc-topbar-height: 56px;
    --orc-topbar-bg: #ffffff;
    --orc-topbar-border: #e9ecef;
    --orc-primary: #4361ee;
    --orc-primary-dark: #3451d1;
    --orc-success: #2dc653;
    --orc-radius: 8px;
    --orc-shadow-card: 0 1px 4px rgba(0,0,0,.08);
    --orc-transition: 0.2s ease;
}

/* -----------------------------------------------
   Reset / base
   ----------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.9rem;
    background: #f4f6fb;
    color: #2d3748;
    margin: 0;
}

a { color: var(--orc-primary); }
a:hover { color: var(--orc-primary-dark); text-decoration: none; }

/* -----------------------------------------------
   Layout principal: sidebar + content
   ----------------------------------------------- */
.orc-wrapper {
    display: flex;
    min-height: 100vh;
}

/* -----------------------------------------------
   Sidebar
   ----------------------------------------------- */
.orc-sidebar {
    width: var(--orc-sidebar-width);
    min-height: 100vh;
    background: var(--orc-sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: width var(--orc-transition);
    overflow-x: hidden;
}

/* Sidebar colapsada */
.orc-wrapper.sidebar-collapsed .orc-sidebar {
    width: var(--orc-sidebar-collapsed-width);
}
.orc-wrapper.sidebar-collapsed .orc-sidebar__logo span,
.orc-wrapper.sidebar-collapsed .orc-sidebar__item a span,
.orc-wrapper.sidebar-collapsed .orc-sidebar__group-label,
.orc-wrapper.sidebar-collapsed .orc-sidebar__user-info {
    display: none;
}
.orc-wrapper.sidebar-collapsed .orc-sidebar__item a {
    justify-content: center;
    padding: 10px 0;
}
.orc-wrapper.sidebar-collapsed .orc-content {
    margin-left: var(--orc-sidebar-collapsed-width);
}

/* Brand / logo */
.orc-sidebar__brand {
    padding: 0 16px;
    height: var(--orc-topbar-height);
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

.orc-sidebar__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--orc-sidebar-brand-color) !important;
    font-weight: 700;
    font-size: 1rem;
    white-space: nowrap;
    text-decoration: none;
}

.orc-sidebar__logo i {
    font-size: 1.2rem;
    color: var(--orc-primary);
    flex-shrink: 0;
}

/* Menu */
.orc-sidebar__menu {
    list-style: none;
    padding: 12px 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.orc-sidebar__group-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(168,174,202,.45);
    padding: 16px 20px 4px;
}

.orc-sidebar__item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--orc-sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background var(--orc-transition), color var(--orc-transition);
    border-radius: 0;
    white-space: nowrap;
    text-decoration: none;
}

.orc-sidebar__item a i {
    width: 18px;
    text-align: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.orc-sidebar__item a:hover {
    color: var(--orc-sidebar-text-active);
    background: var(--orc-sidebar-active-bg);
}

.orc-sidebar__item.active a {
    color: var(--orc-sidebar-text-active);
    background: var(--orc-sidebar-active-bg);
    border-left: 3px solid var(--orc-primary);
}

/* Usuário logado (base da sidebar) */
.orc-sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

.orc-sidebar__user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--orc-primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.orc-sidebar__user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.orc-sidebar__user-name {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.orc-sidebar__user-role {
    font-size: 0.65rem;
}

/* -----------------------------------------------
   Conteúdo principal
   ----------------------------------------------- */
.orc-content {
    margin-left: var(--orc-sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-left var(--orc-transition);
}

/* -----------------------------------------------
   Topbar
   ----------------------------------------------- */
.orc-topbar {
    height: var(--orc-topbar-height);
    background: var(--orc-topbar-bg);
    border-bottom: 1px solid var(--orc-topbar-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 900;
    gap: 16px;
}

.orc-topbar__toggle {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color var(--orc-transition);
}
.orc-topbar__toggle:hover { color: #343a40; }

.orc-topbar__breadcrumb {
    flex: 1;
    background: none;
    padding: 0;
    margin: 0;
    font-size: 0.8rem;
}

.orc-topbar__agency {
    font-size: 0.8rem;
    color: #6c757d;
    margin-right: 8px;
    white-space: nowrap;
}

.orc-topbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* -----------------------------------------------
   Flash messages container
   ----------------------------------------------- */
.orc-flash-container .alert {
    border-radius: var(--orc-radius);
    font-size: 0.875rem;
}

/* -----------------------------------------------
   Main
   ----------------------------------------------- */
.orc-main {
    flex: 1;
    padding-top: 24px;
}

/* -----------------------------------------------
   Page header
   ----------------------------------------------- */
.orc-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.orc-page-header__title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
}

.orc-page-header__actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* -----------------------------------------------
   Cards base (orc-card)
   ----------------------------------------------- */
.orc-card {
    border: 1px solid #e9ecef;
    border-radius: var(--orc-radius);
    box-shadow: var(--orc-shadow-card);
}

.orc-card__header {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    font-size: 0.9rem;
    color: #2d3748;
    padding: 12px 16px;
}

/* -----------------------------------------------
   Stat cards (dashboard)
   ----------------------------------------------- */
.orc-stat-card {
    border-radius: var(--orc-radius);
    padding: 20px;
    background: #fff;
    box-shadow: var(--orc-shadow-card);
    border: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.orc-stat-card__icon {
    font-size: 1.6rem;
    margin-bottom: 12px;
    opacity: 0.8;
}

.orc-stat-card--primary .orc-stat-card__icon { color: var(--orc-primary); }
.orc-stat-card--success .orc-stat-card__icon { color: var(--orc-success); }
.orc-stat-card--info    .orc-stat-card__icon { color: #0eb5c1; }
.orc-stat-card--neutral .orc-stat-card__icon { color: #adb5bd; }

.orc-stat-card__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 700;
    color: #6c757d;
    margin: 0 0 4px;
}

.orc-stat-card__value {
    font-size: 2rem;
    font-weight: 800;
    color: #1a202c;
    margin: 0 0 12px;
    line-height: 1;
}

.orc-stat-card__link {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--orc-primary);
    margin-top: auto;
}
.orc-stat-card__link:hover { color: var(--orc-primary-dark); }

/* -----------------------------------------------
   Shortcut cards (dashboard)
   ----------------------------------------------- */
.orc-shortcut {
    border-radius: var(--orc-radius);
    background: #fff;
    border: 1px solid #e9ecef;
    box-shadow: var(--orc-shadow-card);
    transition: box-shadow var(--orc-transition), transform var(--orc-transition);
}

.orc-shortcut:hover {
    box-shadow: 0 4px 12px rgba(67,97,238,.12);
    transform: translateY(-2px);
}

.orc-shortcut a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    color: #2d3748;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
}

.orc-shortcut a i {
    font-size: 1.3rem;
    color: var(--orc-primary);
}

/* -----------------------------------------------
   Tables
   ----------------------------------------------- */
.orc-table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6c757d;
    font-weight: 700;
    border-top: none;
    border-bottom: 2px solid #e9ecef;
    padding: 10px 16px;
    white-space: nowrap;
}

.orc-table td {
    padding: 12px 16px;
    vertical-align: middle;
    border-color: #f1f3f5;
    font-size: 0.875rem;
}

.orc-table tbody tr:hover { background: #f8f9fc; }

/* -----------------------------------------------
   Formulários (orc-form)
   ----------------------------------------------- */
.orc-form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 4px;
}

.orc-form-hint {
    display: block;
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 4px;
}

.form-control:focus {
    border-color: var(--orc-primary);
    box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}

/* -----------------------------------------------
   Badges de status
   ----------------------------------------------- */
.badge-active   { /* alias: badge-success */ }
.badge-inactive { background-color: #dee2e6; color: #495057; }
.badge-draft    { background-color: #e2e8f0; color: #4a5568; }

/* -----------------------------------------------
   LOGIN PAGE
   ----------------------------------------------- */
.orc-login-page {
    background: #f0f2f8;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orc-login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.orc-login-card {
    width: 100%;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    padding: 36px 36px 28px;
}

.orc-login-card__header {
    text-align: center;
    margin-bottom: 28px;
}

.orc-login-card__logo {
    color: var(--orc-primary);
    margin-bottom: 12px;
}

.orc-login-card__title {
    font-size: 1.3rem;
    font-weight: 800;
    color: #1a202c;
    margin: 0 0 4px;
}

.orc-login-card__subtitle {
    font-size: 0.875rem;
    color: #6c757d;
    margin: 0;
}

.orc-login-form .form-group { margin-bottom: 18px; }
.orc-login-form .form-control-lg { font-size: 0.95rem; }

.orc-login-btn {
    background: var(--orc-primary);
    border-color: var(--orc-primary);
    font-weight: 700;
    letter-spacing: .02em;
    margin-top: 8px;
}
.orc-login-btn:hover {
    background: var(--orc-primary-dark);
    border-color: var(--orc-primary-dark);
}

/* Campo de senha com toggle */
.orc-input-password {
    position: relative;
}

.orc-input-password .form-control {
    padding-right: 44px;
}

.orc-input-password__toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    transition: color var(--orc-transition);
}
.orc-input-password__toggle:hover { color: #343a40; }

.orc-login-footer {
    margin-top: 20px;
    font-size: 0.78rem;
    color: #adb5bd;
}

/* -----------------------------------------------
   Responsive: mobile sidebar overlay
   ----------------------------------------------- */
@media (max-width: 767.98px) {
    .orc-sidebar {
        transform: translateX(-100%);
        transition: transform var(--orc-transition);
    }
    .orc-wrapper.sidebar-open .orc-sidebar {
        transform: translateX(0);
    }
    .orc-content {
        margin-left: 0 !important;
    }
    /* Overlay escuro atrás da sidebar em mobile */
    .orc-wrapper.sidebar-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 999;
    }
    .orc-sidebar { z-index: 1000; }
}
