/**
 * =====================================================
 * YUKAGUARD DESIGN SYSTEM v4.0
 * =====================================================
 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

/* =====================================================
   CSS VARIABLES
   ===================================================== */
:root {
    --p-primary:        #1D4ED8;
    --p-primary-light:  #3B82F6;
    --p-primary-dark:   #1E3A8A;
    --p-accent:         #38BDF8;
    --p-success:        #10B981;
    --p-warning:        #F59E0B;
    --p-danger:         #EF4444;
    --p-info:           #6366F1;
    --p-bg:             #F1F5F9;
    --p-bg-card:        #FFFFFF;
    --p-sidebar:        #0F172A;
    --p-sidebar-hover:  rgba(255,255,255,0.06);
    --p-sidebar-active: rgba(56,189,248,0.12);
    --p-text-main:      #0F172A;
    --p-text-muted:     #64748B;
    --p-text-light:     #94A3B8;
    --p-text-sidebar:   rgba(255,255,255,0.65);
    --p-border:         #E2E8F0;
    --sidebar-w:        268px;
    --radius-xs:        6px;
    --radius-sm:        10px;
    --radius-md:        14px;
    --radius-lg:        20px;
    --radius-xl:        28px;
    --shadow-xs:   0 1px 2px rgba(0,0,0,0.06);
    --shadow-sm:   0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
    --shadow-lg:   0 12px 32px rgba(0,0,0,0.10), 0 4px 12px rgba(0,0,0,0.06);
    --t-fast:   150ms ease;
    --t-base:   250ms ease;
    --t-slow:   400ms cubic-bezier(0.16,1,0.3,1);
}

/* =====================================================
   BASE
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--p-bg);
    color: var(--p-text-main);
    margin: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    font-size: 0.9375rem;
    line-height: 1.6;
}
h1,h2,h3,h4,h5,h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    color: var(--p-text-main);
}
a { text-decoration: none; color: inherit; }

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to   { transform: translateX(0); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.animate-fade-up { animation: fadeInUp var(--t-slow) both; }

/* =====================================================
   LAYOUT
   ===================================================== */
#sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    position: fixed;
    left: 0; top: 0;
    background: var(--p-sidebar);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: slideInLeft 0.45s cubic-bezier(0.16,1,0.3,1);
    border-right: 1px solid rgba(255,255,255,0.04);
}
#content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    padding: 2rem 2.5rem 3rem;
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.logo-area {
    padding: 1.5rem 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.logo-area img { height: 38px; object-fit: contain; flex-shrink: 0; }
.logo-area-text h1 { font-size: 1.15rem; margin: 0; color: #fff; }
.logo-area-text h1 span { color: var(--p-accent); }
.logo-area-text p { font-size: 0.62rem; color: rgba(255,255,255,.3); text-transform: uppercase; letter-spacing: 2px; margin: 2px 0 0; }

.nav-links {
    flex: 1;
    overflow-y: auto;
    padding: 0.875rem 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.875rem;
    border-radius: var(--radius-sm);
    color: var(--p-text-sidebar);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all var(--t-base);
    position: relative;
    white-space: nowrap;
}
.nav-item i { font-size: 0.95rem; width: 18px; text-align: center; flex-shrink: 0; transition: color var(--t-fast); }
.nav-item:hover { background: var(--p-sidebar-hover); color: #fff; }
.nav-item.active { background: var(--p-sidebar-active); color: #fff; font-weight: 600; }
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    background: var(--p-accent);
    border-radius: 0 4px 4px 0;
}
.nav-item.active i { color: var(--p-accent); }

.nav-section-label {
    padding: 1rem 0.875rem 0.35rem;
    font-size: 0.62rem;
    font-weight: 700;
    color: rgba(255,255,255,0.22);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.user-profile {
    padding: 0.875rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.profile-img {
    width: 38px; height: 38px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid rgba(56,189,248,0.35);
    flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 0; }
.profile-name { font-size: 0.85rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-role { font-size: 0.68rem; color: rgba(255,255,255,0.38); }
.logout-icon {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    background: rgba(239,68,68,.1);
    color: var(--p-danger);
    cursor: pointer;
    transition: all var(--t-fast);
    font-size: 0.8rem;
}
.logout-icon:hover { background: rgba(239,68,68,.2); transform: scale(1.05); }

/* =====================================================
   CONTENT HEADER
   ===================================================== */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 1rem;
}
.content-header h1 { font-size: 1.7rem; margin: 0 0 2px; letter-spacing: -0.4px; }
.content-header p { color: var(--p-text-muted); margin: 0; font-size: 0.875rem; }

/* =====================================================
   CARDS
   ===================================================== */
.p-card {
    background: var(--p-bg-card);
    border: 1px solid var(--p-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: box-shadow var(--t-base);
}
.p-card:hover { box-shadow: var(--shadow-md); }

.p-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}
.p-card-header h5 { margin: 0; font-size: 1rem; display: flex; align-items: center; gap: 0.625rem; }
.p-card-header h5 i { color: var(--p-primary); }

/* =====================================================
   KPI CARDS
   ===================================================== */
.kpi-card { position: relative; overflow: hidden; }
.kpi-icon-bg { position: absolute; right: -8px; top: -8px; font-size: 5rem; opacity: 0.035; transform: rotate(-12deg); }
.kpi-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--p-text-muted); margin-bottom: .4rem; }
.kpi-value { font-family: 'Outfit', sans-serif; font-size: 2.2rem; font-weight: 800; line-height: 1; margin-bottom: .5rem; }
.kpi-footer { font-size: 0.78rem; font-weight: 500; display: flex; align-items: center; gap: .4rem; }

/* =====================================================
   BADGES
   ===================================================== */
.p-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .7rem;
    border-radius: 50px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    line-height: 1;
    white-space: nowrap;
}

/* OS Status */
.status-aberto    { background: rgba(239,68,68,.1);   color: #DC2626; border: 1px solid rgba(239,68,68,.2); }
.status-analise   { background: rgba(99,102,241,.1);  color: #4F46E5; border: 1px solid rgba(99,102,241,.2); }
.status-resolvido { background: rgba(16,185,129,.1);  color: #059669; border: 1px solid rgba(16,185,129,.2); }
.status-cancelado { background: rgba(100,116,139,.1); color: #475569; border: 1px solid rgba(100,116,139,.2); }

/* Assinatura Status */
.status-assinado   { background: rgba(16,185,129,.1);  color: #059669; border: 1px solid rgba(16,185,129,.2); }
.status-naosignado { background: rgba(239,68,68,.1);   color: #DC2626; border: 1px solid rgba(239,68,68,.2); }
.status-pendente   { background: rgba(245,158,11,.1);  color: #D97706; border: 1px solid rgba(245,158,11,.2); }

/* Roles */
.badge-role-gestor     { background: rgba(29,78,216,.1);  color: #1D4ED8;  border: 1px solid rgba(29,78,216,.2); }
.badge-role-tecnico    { background: rgba(16,185,129,.1); color: #059669;  border: 1px solid rgba(16,185,129,.2); }
.badge-role-noc        { background: rgba(99,102,241,.1); color: #4F46E5;  border: 1px solid rgba(99,102,241,.2); }
.badge-role-projetista { background: rgba(245,158,11,.1); color: #D97706;  border: 1px solid rgba(245,158,11,.2); }

/* =====================================================
   BUTTONS
   ===================================================== */
.p-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: .875rem;
    line-height: 1;
    transition: all var(--t-base);
    border: 1.5px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
}
.p-btn:focus-visible { outline: 3px solid var(--p-accent); outline-offset: 2px; }

.p-btn-primary {
    background: var(--p-primary);
    color: #fff;
    border-color: var(--p-primary);
    box-shadow: 0 2px 8px rgba(29,78,216,.25);
}
.p-btn-primary:hover {
    background: var(--p-primary-light);
    border-color: var(--p-primary-light);
    box-shadow: 0 4px 16px rgba(29,78,216,.35);
    color: #fff;
    transform: translateY(-1px);
}

.p-btn-ghost {
    background: transparent;
    color: var(--p-text-muted);
    border-color: var(--p-border);
}
.p-btn-ghost:hover { background: var(--p-bg); color: var(--p-text-main); }

.p-btn-danger {
    background: rgba(239,68,68,.08);
    color: var(--p-danger);
    border-color: rgba(239,68,68,.2);
}
.p-btn-danger:hover { background: var(--p-danger); color: #fff; border-color: var(--p-danger); }

.p-btn-icon { width: 36px; height: 36px; padding: 0; }

/* =====================================================
   TABLES
   ===================================================== */
.p-table-wrap { overflow-x: auto; }

.p-table {
    width: 100%;
    border-collapse: collapse;
}

.p-table thead th {
    padding: .6rem 1rem;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--p-text-muted);
    background: var(--p-bg);
    border-bottom: 1px solid var(--p-border);
    white-space: nowrap;
}

.p-table tbody tr {
    border-bottom: 1px solid var(--p-border);
    transition: background var(--t-fast);
}
.p-table tbody tr:last-child { border-bottom: none; }
.p-table tbody tr:hover { background: #F8FAFC; }

.p-table td {
    padding: .875rem 1rem;
    vertical-align: middle;
    font-size: .875rem;
}

/* =====================================================
   FORMS
   ===================================================== */
.p-input-group { margin-bottom: 1.2rem; }

.p-label {
    display: block;
    margin-bottom: .4rem;
    font-size: .8rem;
    font-weight: 600;
    color: #374151;
}

.p-input {
    display: block;
    width: 100%;
    padding: .7rem .9rem;
    border: 1.5px solid var(--p-border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: .9rem;
    color: var(--p-text-main);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
    font-family: 'Inter', sans-serif;
    outline: none;
    appearance: none;
}
.p-input:hover { border-color: #CBD5E1; }
.p-input:focus { border-color: var(--p-primary); box-shadow: 0 0 0 3px rgba(29,78,216,.1); }
.p-input::placeholder { color: var(--p-text-light); }
.p-input[disabled], .p-input:disabled { background: var(--p-bg); color: var(--p-text-muted); cursor: not-allowed; }

.p-input-wrap { position: relative; }
.p-input-wrap .input-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--p-text-muted);
    font-size: .9rem;
}
.p-input-wrap .input-icon-left  { left: .9rem; }
.p-input-wrap .input-icon-right { right: .9rem; }
.p-input-icon-left  { padding-left: 2.75rem; }
.p-input-icon-right { padding-right: 2.75rem; }

/* =====================================================
   MODALS
   ===================================================== */
.premium-modal { z-index: 2000 !important; }
.premium-modal .modal-dialog { max-width: 540px; }
.premium-modal .modal-content {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.premium-modal .modal-header {
    background: var(--p-sidebar);
    color: #fff;
    padding: 1.2rem 1.5rem;
    border: none;
}
.premium-modal .modal-header .modal-title { font-family: 'Outfit', sans-serif; font-size: 1rem; font-weight: 700; }
.premium-modal .modal-header .btn-close { filter: brightness(0) invert(1); opacity: .6; }
.premium-modal .modal-header .btn-close:hover { opacity: 1; }
.premium-modal .modal-body { padding: 1.75rem 1.5rem; }
.premium-modal .modal-footer { padding: 1rem 1.5rem 1.5rem; border: none; gap: .75rem; }

/* =====================================================
   ALERTS
   ===================================================== */
.p-alert {
    padding: .875rem 1.125rem;
    border-radius: var(--radius-md);
    font-size: .875rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    margin-bottom: 1.25rem;
}
.p-alert-success { background: rgba(16,185,129,.08); border: 1px solid rgba(16,185,129,.2); color: #065F46; }
.p-alert-danger  { background: rgba(239,68,68,.08);  border: 1px solid rgba(239,68,68,.2);  color: #7F1D1D; }
.p-alert-info    { background: rgba(99,102,241,.08); border: 1px solid rgba(99,102,241,.2); color: #312E81; }
.p-alert-warning { background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.2); color: #78350F; }
.p-alert i { font-size: 1rem; margin-top: 1px; flex-shrink: 0; }

/* =====================================================
   TABS
   ===================================================== */
.p-tabs {
    display: flex;
    gap: 2px;
    background: var(--p-bg);
    border-radius: var(--radius-sm);
    padding: 3px;
}
.p-tab {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .55rem 1rem;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--p-text-muted);
    cursor: pointer;
    transition: all var(--t-fast);
    border: none;
    background: transparent;
    text-decoration: none;
}
.p-tab:hover { color: var(--p-text-main); background: rgba(0,0,0,.04); }
.p-tab.active { background: #fff; color: var(--p-primary); box-shadow: var(--shadow-xs); }

/* =====================================================
   PAGINATION
   ===================================================== */
.p-pagination { display: flex; gap: 4px; align-items: center; }
.p-page-btn {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-xs);
    font-size: .825rem; font-weight: 600;
    border: 1.5px solid var(--p-border);
    background: #fff;
    color: var(--p-text-muted);
    cursor: pointer;
    transition: all var(--t-fast);
    text-decoration: none;
}
.p-page-btn:hover { border-color: var(--p-primary); color: var(--p-primary); background: rgba(29,78,216,.05); }
.p-page-btn.active { background: var(--p-primary); border-color: var(--p-primary); color: #fff; }

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-body {
    background: var(--p-sidebar) !important;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.login-card .p-label { color: rgba(255,255,255,.65); }
.login-card .p-input { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12); color: #fff; }
.login-card .p-input:hover { border-color: rgba(255,255,255,.25); }
.login-card .p-input:focus { border-color: var(--p-accent); box-shadow: 0 0 0 3px rgba(56,189,248,.2); background: rgba(255,255,255,.1); }
.login-card .p-input::placeholder { color: rgba(255,255,255,.25); }
.login-card .input-icon { color: rgba(255,255,255,.3); }

/* =====================================================
   SEARCH
   ===================================================== */
.p-search {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1.5px solid var(--p-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.p-search:focus-within { border-color: var(--p-primary); box-shadow: 0 0 0 3px rgba(29,78,216,.1); }
.p-search-icon { padding: 0 .75rem; color: var(--p-text-light); font-size: .85rem; }
.p-search input { border: none; outline: none; padding: .6rem .5rem .6rem 0; font-size: .875rem; font-family: 'Inter', sans-serif; color: var(--p-text-main); background: transparent; width: 210px; }
.p-search input::placeholder { color: var(--p-text-light); }

/* =====================================================
   UTILITY
   ===================================================== */
.tiny { font-size: .75rem; }
.fw-semibold { font-weight: 600 !important; }
.divider { border: none; border-top: 1px solid var(--p-border); margin: 1.5rem 0; }
.code-tag { font-family: 'SFMono-Regular', Consolas, monospace; font-size: .8rem; background: rgba(29,78,216,.07); color: var(--p-primary); padding: .15rem .5rem; border-radius: var(--radius-xs); font-weight: 600; }
.id-chip { display: inline-flex; align-items: center; background: var(--p-bg); border: 1.5px solid var(--p-border); border-radius: 6px; font-size: .7rem; font-weight: 700; color: var(--p-text-muted); padding: .15rem .45rem; font-family: monospace; }

/* Settings page uses Bootstrap native, normalize here */
.card { border-radius: var(--radius-lg) !important; border-color: var(--p-border) !important; box-shadow: var(--shadow-sm) !important; }
.card-header { border-color: var(--p-border) !important; border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important; }
.form-control:focus { border-color: var(--p-primary) !important; box-shadow: 0 0 0 3px rgba(29,78,216,.1) !important; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 991.98px) {
    #sidebar { display: none; }
    #content { margin-left: 0; padding: 1.25rem; }
    .content-header h1 { font-size: 1.4rem; }
}
@media (max-width: 767.98px) {
    .kpi-value { font-size: 1.75rem; }
    .p-table td, .p-table th { padding: .75rem; }
}
