/* =========================
   LBA Serralheria - CSS Global
   ========================= */

:root {
    --lba-dark: #111827;
    --lba-dark-2: #1f2937;
    --lba-dark-3: #374151;
    --lba-bg: #f3f4f6;
    --lba-card: #ffffff;
    --lba-text: #111827;
    --lba-muted: #6b7280;
    --lba-border: #e5e7eb;
    --lba-primary: #212121;
    --lba-success: #16a34a;
    --lba-danger: #dc2626;
    --lba-warning: #f59e0b;
    --lba-blue: #2563eb;
    --lba-purple: #7c3aed;
}

/* =========================
   Geral
   ========================= */

html,
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: var(--lba-bg);
    font-size: 14px;
    color: #212529;
}

body {
    min-height: 100vh;
}

/* =========================
   Containers
   ========================= */

.container {
    max-width: 1200px;
}

/* =========================
   Navbar
   ========================= */

.navbar-lba {
    background: linear-gradient(135deg, var(--lba-dark), var(--lba-dark-2));
    min-height: 72px;
    position: relative;
    z-index: 1030;
}

.navbar-logo,
.navbar-lba .navbar-brand img {
    width: 58px;
    height: auto;
    object-fit: contain;
}

.navbar-lba .navbar-brand {
    color: #ffffff;
    font-weight: 700;
}

.brand-text {
    font-weight: 700;
    letter-spacing: 0.4px;
    font-size: 1.05rem;
    color: #ffffff;
}

.navbar-lba .nav-link {
    color: rgba(255, 255, 255, 0.84);
    font-weight: 500;
    padding: 10px 14px;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
}

.navbar-lba .nav-link:hover,
.navbar-lba .nav-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.navbar-lba .dropdown-menu,
.dropdown-menu-lba {
    background-color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 8px;
    margin-top: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
    z-index: 1050;
}

.navbar-lba .dropdown-item,
.dropdown-menu-lba .dropdown-item {
    color: var(--lba-text);
    border-radius: 8px;
    padding: 9px 14px;
    font-weight: 500;
}

.navbar-lba .dropdown-item:hover,
.dropdown-menu-lba .dropdown-item:hover {
    background: #f1f5f9;
    color: var(--lba-text);
}

.user-info {
    line-height: 1.1;
}

.user-name {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
}

.user-role {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.btn-nav {
    border-radius: 10px;
    padding: 8px 16px;
    font-weight: 600;
}

.btn-logout {
    background: var(--lba-danger);
    color: #ffffff;
    border: none;
}

.btn-logout:hover {
    background: #b91c1c;
    color: #ffffff;
}

/* =========================
   Cards Globais
   ========================= */

.card {
    border-radius: 12px;
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Evita conflito com Bootstrap text-bg */
.card.text-bg-success { border-left: 4px solid #198754; }
.card.text-bg-danger  { border-left: 4px solid #dc3545; }
.card.text-bg-info    { border-left: 4px solid #0dcaf0; }
.card.text-bg-warning { border-left: 4px solid #ffc107; }
.card.text-bg-primary { border-left: 4px solid #0d6efd; }
.card.bg-dark         { border-left: 4px solid #6c757d; }

/* =========================
   Botões
   ========================= */

.btn {
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--lba-primary);
    border-color: var(--lba-primary);
}

.btn-primary:hover {
    background-color: #333333;
    border-color: #333333;
}

/* =========================
   Formulários
   ========================= */

.form-control,
.form-select,
textarea {
    border-radius: 8px;
}

form input,
form select,
form textarea {
    margin-bottom: 10px;
}

/* =========================
   Tabelas
   ========================= */

.table {
    background: #ffffff;
}

.table th {
    background-color: var(--lba-primary);
    color: #ffffff;
}

.dashboard-lba .table thead th {
    background: transparent;
    color: var(--lba-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    border-bottom: 1px solid var(--lba-border);
}

/* =========================
   Pré-visualização de Imagem
   ========================= */

#preview-img {
    max-height: 200px;
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 5px;
    display: none;
    background-color: #fff;
}

#preview-img[src]:not([src=""]) {
    display: block;
}

/* =========================
   Calculadora
   ========================= */

.card-calculadora-wrapper {
    background-color: #f4f6f9;
    padding: 40px 15px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.card-calculadora {
    width: 100%;
    max-width: 600px;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    padding: 30px;
    background-color: #fff;
}

.card-calculadora .form-control,
.card-calculadora button {
    width: 100%;
    box-sizing: border-box;
}

.card-calculadora h3,
.card-calculadora h5 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

/* =========================
   Orçamento - Impressão / Visualização
   ========================= */

.orcamento-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.orcamento-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.orcamento-logo {
    max-width: 90px;
    height: auto;
}

.orcamento-info h2 {
    font-size: 20px;
    margin: 0;
}

.orcamento-info p {
    margin: 0;
    font-size: 13px;
    line-height: 1.3;
}

.orcamento-right {
    text-align: right;
}

/* =========================
   Dashboard
   ========================= */

.dashboard-lba {
    background: var(--lba-bg);
    min-height: 100vh;
}

.dashboard-hero {
    background: linear-gradient(135deg, var(--lba-dark), var(--lba-dark-3));
    color: #fff;
    border-radius: 18px;
    padding: 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
}

.dashboard-hero h2 {
    font-weight: 800;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-card {
    border: none;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.stat-card {
    padding: 22px;
    min-height: 145px;
    border-left: 5px solid #64748b;
}

.stat-card span {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
}

.stat-card h3 {
    margin: 10px 0 6px;
    font-weight: 800;
    color: var(--lba-text);
}

.stat-card small {
    color: var(--lba-muted);
}

.stat-green {
    border-left-color: var(--lba-success);
}

.stat-red {
    border-left-color: var(--lba-danger);
}

.stat-blue {
    border-left-color: var(--lba-blue);
}

.stat-purple {
    border-left-color: var(--lba-purple);
}

.os-line,
.payment-line,
.client-line,
.movement-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--lba-border);
}

.os-line:last-child,
.payment-line:last-child,
.client-line:last-child,
.movement-line:last-child {
    border-bottom: none;
}

.os-line span,
.payment-line span {
    color: #4b5563;
}

.os-line strong,
.payment-line strong,
.client-line span,
.movement-line span {
    font-weight: 800;
}

.client-line div,
.movement-line div {
    display: flex;
    flex-direction: column;
}

.client-line small,
.movement-line small {
    color: var(--lba-muted);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.quick-btn {
    text-decoration: none;
    color: var(--lba-text);
    background: #f9fafb;
    border: 1px solid var(--lba-border);
    padding: 14px 16px;
    border-radius: 14px;
    font-weight: 700;
    text-align: center;
    transition: 0.2s ease;
}

.quick-btn:hover {
    background: var(--lba-dark);
    color: #fff;
    transform: translateY(-2px);
}

/* =========================
   Mobile / Tablet
   ========================= */

@media (max-width: 991px) {
    .navbar-lba {
        min-height: auto;
    }

    .navbar-nav {
        padding-top: 12px;
        margin-top: 10px;
    }

    .navbar-lba .navbar-collapse {
        padding-top: 10px;
    }

    .navbar-lba .nav-link {
        padding: 12px;
        font-size: 20px;
        line-height: 1.2;
    }

    .navbar-lba .dropdown-menu,
    .dropdown-menu-lba {
        position: static !important;
        float: none;
        width: 100%;
        margin: 6px 0 10px;
        border: 0;
        border-radius: 10px;
        box-shadow: none;
    }

    .navbar-lba .dropdown-item {
        padding: 10px 14px;
        font-size: 18px;
        line-height: 1.2;
    }

    .navbar-lba .dropdown-toggle::after {
        transform: scale(1.2);
        margin-left: 8px;
    }

    .user-area {
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid rgba(255,255,255,0.15);
        justify-content: space-between;
    }

    .btn-logout {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .dashboard-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-actions {
        width: 100%;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .dashboard-lba {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .stat-card h3 {
        font-size: 1.45rem;
    }

    .orcamento-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .orcamento-right {
        text-align: left;
    }
}

@media (max-width: 575px) {
    html,
    body {
        font-size: 13px;
    }

    .container,
    .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .card {
        border-radius: 10px;
    }

    .card .card-body {
        padding: 12px !important;
    }

    .form-control,
    .form-select,
    textarea {
        padding: 8px 10px !important;
        font-size: 14px !important;
    }

    .btn {
        padding: 8px 12px !important;
        font-size: 14px !important;
    }

    h1 { font-size: 20px; }
    h2 { font-size: 18px; }
    h3 { font-size: 16px; }

    .navbar-lba .nav-link {
        font-size: 18px;
    }

    .navbar-lba .dropdown-item {
        font-size: 16px;
    }

    .stat-card {
        min-height: auto;
    }
}

/* =========================
   Impressão
   ========================= */

@media print {
    body {
        font-size: 12px;
        background: #ffffff;
    }

    .btn,
    .navbar,
    footer,
    .hero-actions,
    .quick-actions {
        display: none !important;
    }

    .card,
    .dashboard-card {
        box-shadow: none !important;
        border: none !important;
    }

    .orcamento-logo {
        max-width: 70px;
    }

    .table {
        font-size: 11px;
    }

    .table th,
    .table td {
        padding: 4px !important;
    }

    hr {
        margin: 6px 0;
    }

    .section-title {
        margin-top: 10px;
        margin-bottom: 4px;
    }
}

.smart-picker {
    position: relative;
}

.smart-search {
    border-radius: 10px;
}

.smart-results {
    display: none;
    position: absolute;
    z-index: 2000;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 10px;
    margin-top: 4px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.smart-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
}

.smart-item:hover {
    background: #f3f4f6;
}

.smart-item strong {
    display: block;
    color: #111827;
}

.smart-item small {
    color: #6b7280;
}

/* =========================
   SMART PICKER ORÇAMENTO
========================= */

.smart-picker {
    position: relative;
    margin-bottom: 15px;
}

.smart-search {
    height: 48px;
    border: 2px solid #d1d5db;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 15px;
    background: #fff;
    transition: all 0.2s ease;
}

.smart-search:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.20rem rgba(13,110,253,.15);
    background: #ffffff;
}

.smart-results {
    display: none;
    position: absolute;
    z-index: 9999;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 2px solid #dbe3ea;
    border-radius: 14px;
    overflow: hidden;
    max-height: 350px;
    overflow-y: auto;
    box-shadow:
        0 12px 28px rgba(0,0,0,0.12),
        0 2px 6px rgba(0,0,0,0.06);
}

/* Scroll bonito */
.smart-results::-webkit-scrollbar {
    width: 10px;
}

.smart-results::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 20px;
}

.smart-results::-webkit-scrollbar-track {
    background: #f8fafc;
}

.smart-item {
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
}

.smart-item:last-child {
    border-bottom: none;
}

.smart-item:hover {
    background: #f1f5f9;
    transform: translateX(2px);
}

.smart-item strong {
    display: block;
    color: #111827;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.smart-item small {
    color: #2563eb;
    font-size: 13px;
    font-weight: 600;
}

/* Labels da seção */
.form-label,
label {
    font-weight: 600;
    color: #374151;
}

/* Destaque visual das tabelas */
#materiais-table,
#pintura-table,
#custos-table {
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
}

#materiais-table thead,
#pintura-table thead,
#custos-table thead {
    background: #111827;
    color: #fff;
}

#materiais-table th,
#pintura-table th,
#custos-table th {
    font-size: 13px;
    font-weight: 600;
    padding: 14px 10px;
}

#materiais-table td,
#pintura-table td,
#custos-table td {
    vertical-align: middle;
    padding: 10px;
}

/* Campo quantidade */
.qtd-cons,
.qtd-pint,
.qtd-cust {
    min-width: 90px;
    border-radius: 8px;
    text-align: center;
}

/* Botão remover */
.btn-remover,
.btn-remover-pint,
.btn-remover-cust {
    border-radius: 8px;
    font-size: 12px;
    padding: 6px 10px;
}

/* Card principal */
.card.shadow {
    border-radius: 18px;
    border: 1px solid #e5e7eb;
    box-shadow:
        0 10px 25px rgba(0,0,0,0.05),
        0 2px 8px rgba(0,0,0,0.04);
}

/* Títulos */
.card h3 {
    font-weight: 700;
    color: #111827;
}

.stat-card {
    border-radius: 16px;
    min-height: 170px;
}

/* =========================
   NOTIFICAÇÕES NAVBAR
========================= */

.btn-notification {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: none;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-size: 18px;
    transition: 0.2s;
}

.btn-notification:hover {
    background: rgba(255,255,255,0.22);
    color: #fff;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    min-width: 20px;
    height: 20px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid #fff;
}

.notification-dropdown {
    width: 340px;
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow:
        0 12px 30px rgba(0,0,0,0.12),
        0 2px 10px rgba(0,0,0,0.08);
}

.notification-header {
    padding: 14px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.notification-item:hover {
    background: #f8fafc;
}

.notification-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.notification-footer {
    padding: 12px;
    background: #f8fafc;
}

/* =========================
   VISUALIZAR ORÇAMENTO - MOBILE
========================= */

.orcamento-view {
    max-width: 1100px;
    margin: 0 auto;
}

.orcamento-view .card-body {
    overflow-x: hidden;
}

.orcamento-view table {
    width: 100%;
}

.orcamento-view .table-responsive-mobile {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.orcamento-view .totais-table {
    width: 100% !important;
    max-width: 520px;
}

@media (max-width: 768px) {
    .orcamento-view {
        padding-left: 8px;
        padding-right: 8px;
    }

    .orcamento-view .card {
        border-radius: 12px;
    }

    .orcamento-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .orcamento-left {
        width: 100%;
        align-items: flex-start;
    }

    .orcamento-logo {
        max-width: 72px;
    }

    .orcamento-info h2 {
        font-size: 18px;
    }

    .orcamento-info p {
        font-size: 12px;
    }

    .orcamento-right {
        width: 100%;
        text-align: left;
        padding-top: 8px;
        border-top: 1px solid #e5e7eb;
    }

    .compact-row > div {
        margin-bottom: 12px;
    }

    .table-materials {
        min-width: 650px;
        font-size: 13px;
    }

    .totais-table {
        min-width: 100%;
        font-size: 13px;
    }

    .orcamento-view .btn {
        width: 100%;
        margin-bottom: 8px;
    }
}

@media (max-width: 480px) {
    .table-materials {
        min-width: 720px;
    }

    .orcamento-view h6 {
        font-size: 15px;
    }

    .orcamento-view p {
        font-size: 13px;
    }
}

/* Visualizar orçamento - ajuste mobile final */

.orcamento-view {
    max-width: 1100px;
    margin: 0 auto;
}

.orcamento-view .card-body {
    overflow-x: hidden;
}

.table-responsive-mobile {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 14px;
}

.orcamento-view .totais-table {
    width: 100% !important;
    max-width: 520px;
}

@media (max-width: 768px) {
    .orcamento-view {
        padding-left: 6px !important;
        padding-right: 6px !important;
    }

    .orcamento-view .card-body {
        padding: 12px !important;
    }

    .orcamento-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .orcamento-left {
        width: 100%;
        align-items: flex-start;
    }

    .orcamento-logo {
        max-width: 70px;
    }

    .orcamento-info h2 {
        font-size: 18px;
    }

    .orcamento-info p {
        font-size: 12px;
    }

    .orcamento-right {
        width: 100%;
        text-align: left;
        border-top: 1px solid #e5e7eb;
        padding-top: 8px;
    }

    .compact-row > div {
        margin-bottom: 12px;
    }

    .table-materials {
        min-width: 680px;
        font-size: 13px;
    }

    .totais-table {
        min-width: 100%;
        font-size: 13px;
    }

    .orcamento-view .btn {
        width: 100%;
        margin-bottom: 8px;
    }

    .orcamento-view p {
        font-size: 13px;
    }
}

/* =========================
   CARD DE LEMBRETES DASHBOARD
========================= */

.lembrete-card-dashboard {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(124,58,237,0.16), transparent 35%),
        linear-gradient(135deg, #ffffff, #bfbfbf);
    border: 1px solid #ede9fe;
}

.lembrete-card-dashboard::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(180deg, #f5bb4e, #a855f7);
}

.lembrete-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.lembrete-card-top span {
    color: #fa5555;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.lembrete-bell {
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, #7c3aed, #fa5555);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 8px 18px rgba(124,58,237,0.28);
}

.lembrete-bell strong {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 20px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.lembrete-card-dashboard h3 {
    margin-top: 10px;
    margin-bottom: 2px;
    color: #f53887;
    font-size: 2rem;
}

.lembrete-card-dashboard > small {
    color: #f53887;
    font-weight: 600;
}

.lembrete-slider {
    min-height: 72px;
    margin-top: 14px;
    padding: 12px;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid #ede9fe;
    position: relative;
    overflow: hidden;
}

.lembrete-slide {
    display: none;
    animation: fadeLembrete 0.35s ease;
}

.lembrete-slide.active {
    display: block;
}

.lembrete-slide strong {
    display: block;
    color: #111827;
    font-size: 14px;
    line-height: 1.25;
    font-weight: 800;
}

.lembrete-slide small {
    display: block;
    color: #6b7280;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
}

.lembrete-card-dashboard .btn {
    border-radius: 12px;
    font-weight: 700;
}

@keyframes fadeLembrete {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
