/* Animações */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
/* ========== CONFIG TABS ========== */
.config-tab-btn {
    transition: all 0.2s ease;
}

.config-tab-btn:hover {
    background: rgba(99, 102, 241, 0.05);
}
input[type="checkbox"]:checked + div {
    background-color: #4f46e5;
}

input[type="checkbox"]:focus + div {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

/* Estilos globais */
:root {
    --primary: #6366f1; /* indigo-500 */
    --primary-600: #4f46e5; /* indigo-600 */
    --primary-200: #c7d2fe; /* indigo-200 */
    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --elevated: rgba(2, 6, 23, 0.7);
}

/* Light theme variables */
.theme-light {
    --primary: #4f46e5; /* indigo-600 */
    --primary-600: #4338ca;
    --primary-200: #a5b4fc;
    --slate-900: #f1f5f9;
    --slate-800: #e2e8f0;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #1f2937;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Light theme overrides */
body.theme-light {
    color: #111827;
}

body.theme-light .tab-content,
body.theme-light .modal-content,
body.theme-light .item-orcamento {
    background: #ffffff;
}

body.theme-light table tbody tr:hover {
    background-color: rgba(15, 23, 42, 0.05);
}

body.theme-light .status-aberto {
    background: rgba(79, 70, 229, 0.08);
    color: #3730a3;
    border-color: rgba(79, 70, 229, 0.25);
}

body.theme-light .item-orcamento input {
    background: #f8fafc;
    color: #0f172a;
}

/* Tabs */
.tab-content {
    animation: slideInUp 0.3s ease;
}

.tab-content.active {
    display: block;
}

.tab-content.hidden {
    display: none;
}

/* Tables */
table {
    animation: slideInUp 0.3s ease;
}

table tbody tr {
    transition: all 0.3s ease;
    border-radius: 0.5rem;
}

table tbody tr:hover {
    background-color: rgba(100, 116, 139, 0.08);
    transform: translateX(2px);
}

/* Botões */
.btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
    position: relative;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.3s ease;
    border-radius: inherit;
}

.btn:hover::before {
    left: 100%;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85em;
    animation: slideInRight 0.2s ease;
}

/* Modal */
.modal-overlay {
    animation: fadeIn 0.2s ease;
}

.modal-content {
    animation: slideInUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Item Orçamento */
.item-orcamento {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    animation: slideInUp 0.25s ease;
    transition: all 0.25s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px -2px rgba(15,23,42,0.08);
}

.item-orcamento:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.item-orcamento input {
    padding: 0.5rem 0.625rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    color: #0f172a;
    font-size: 0.85rem;
    transition: all 0.25s ease;
}

.item-orcamento input:focus {
    background: #ffffff;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    outline: none;
}

.item-orcamento button {
    align-self: center;
}

/* Status Badge */
.status {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85em;
    font-weight: 600;
    animation: slideInRight 0.3s ease;
}

/* Status: use flat, modern badges */
/* Simplified neutral badge styles */
.status-aberto { background: #eef2ff; color: #4338ca; border: 1px solid #c7d2fe; }

.status-pendente { background:#fff7ed; color:#c2410c; border:1px solid #fed7aa; }

.status-em_producao { background:#f5f3ff; color:#6d28d9; border:1px solid #ddd6fe; }

.status-pronto { background:#ecfdf5; color:#047857; border:1px solid #a7f3d0; }

.status-entregue { background:#f0fdfa; color:#0f766e; border:1px solid #99f6e4; }

.status-cancelado { background:#fef2f2; color:#b91c1c; border:1px solid #fecaca; }

.status-rascunho { background:#f1f5f9; color:#475569; border:1px solid #e2e8f0; }

.status-enviado { background:#eff6ff; color:#1e40af; border:1px solid #bfdbfe; }

.status-aprovado { background:#ecfdf5; color:#047857; border:1px solid #a7f3d0; }

.status-rejeitado { background:#fef2f2; color:#b91c1c; border:1px solid #fecaca; }

.status-convertido { background:#f3e8ff; color:#6b21a8; border:1px solid #e9d5ff; }

/* Status Select Dropdown */
.status-select {
    font-weight: 600;
    transition: all 0.2s ease;
    background-size: 16px;
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    padding-right: 2rem;
    appearance: none;
}

.status-select:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.status-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Apply same colors to selects */
.status-select.status-pendente { background-color:#fff7ed; color:#c2410c; }
.status-select.status-em_producao { background-color:#f5f3ff; color:#6d28d9; }
.status-select.status-pronto { background-color:#ecfdf5; color:#047857; }
.status-select.status-entregue { background-color:#f0fdfa; color:#0f766e; }
.status-select.status-cancelado { background-color:#fef2f2; color:#b91c1c; }
.status-select.status-rascunho { background-color:#f1f5f9; color:#475569; }
.status-select.status-enviado { background-color:#eff6ff; color:#1e40af; }
.status-select.status-aprovado { background-color:#ecfdf5; color:#047857; }
.status-select.status-rejeitado { background-color:#fef2f2; color:#b91c1c; }
.status-select.status-convertido { background-color:#f3e8ff; color:#6b21a8; }

/* Dark mode status adjustments */
body.dark .status-select.status-pendente { background-color:#7c2d12; color:#fed7aa; }
body.dark .status-select.status-em_producao { background-color:#581c87; color:#e9d5ff; }
body.dark .status-select.status-pronto { background-color:#064e3b; color:#a7f3d0; }
body.dark .status-select.status-entregue { background-color:#134e4a; color:#99f6e4; }
body.dark .status-select.status-cancelado { background-color:#7f1d1d; color:#fecaca; }
body.dark .status-select.status-rascunho { background-color:#334155; color:#cbd5e1; }
body.dark .status-select.status-enviado { background-color:#1e3a8a; color:#bfdbfe; }
body.dark .status-select.status-aprovado { background-color:#064e3b; color:#a7f3d0; }
body.dark .status-select.status-rejeitado { background-color:#7f1d1d; color:#fecaca; }
body.dark .status-select.status-convertido { background-color:#581c87; color:#e9d5ff; }

/* Dark mode overrides */
body.dark .item-orcamento { background:#1e293b; border-color:#334155; }
body.dark .item-orcamento:hover { background:#243045; border-color:#475569; }
body.dark .item-orcamento input { background:#334155; border-color:#475569; color:#f1f5f9; }
body.dark .item-orcamento input:focus { background:#1e293b; }

/* Responsivo */
@media (max-width: 768px) {
    .item-orcamento {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 0.9em;
    }

    table th,
    table td {
        padding: 0.75rem;
    }
}

/* Notificação */
#notification {
    z-index: 50;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: none;
}

#notification.show {
    display: flex;
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

#notification.hide {
    opacity: 0;
    transform: translateX(100px) scale(0.9);
    pointer-events: none;
}

/* ========== SIDEBAR STYLES ========== */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 16rem;
    background: rgba(255, 255, 255, 0.95);
    border-right: 1px solid #e2e8f0;
    backdrop-filter: blur(8px);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
    z-index: 40;
    display: flex;
    flex-direction: column;
}

.dark .app-sidebar {
    background: rgba(15, 23, 42, 0.95);
    border-right-color: #334155;
}

/* Sidebar collapsed state */
body.sidebar-collapsed .app-sidebar {
    width: 4.5rem;
}

body.sidebar-collapsed .sidebar-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

body.sidebar-collapsed .sidebar-brand-text {
    display: none;
}

body.sidebar-collapsed .sidebar-footer {
    padding: 1rem 0.5rem;
    text-align: center;
}

/* Main content adjustment */
.app-main {
    margin-left: 16rem;
    padding-top: 3.5rem; /* Compensa altura do header fixo (h-14) */
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .app-main {
    margin-left: 4.5rem;
}

/* Sidebar mobile */
@media (max-width: 1023px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    
    .app-sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .app-main {
        margin-left: 0;
    }
    
    body.sidebar-collapsed .app-main {
        margin-left: 0;
    }
}

/* Sidebar menu items */
.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.dark .sidebar-menu-item {
    color: #cbd5e1;
}

.sidebar-menu-item:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.dark .sidebar-menu-item:hover {
    background: #1e293b;
    color: #f1f5f9;
}

.sidebar-menu-item.active {
    background: #eef2ff;
    color: #4338ca;
    font-weight: 600;
}

.dark .sidebar-menu-item.active {
    background: #1e293b;
    color: #818cf8;
}

body.sidebar-collapsed .sidebar-menu-item {
    justify-content: center;
    padding: 0.625rem;
}

/* Sidebar toggle button */
.sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.375rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dark .sidebar-toggle-btn {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}

.sidebar-toggle-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.dark .sidebar-toggle-btn:hover {
    background: #334155;
    color: #f1f5f9;
}

body.sidebar-collapsed .sidebar-toggle-btn svg {
    transform: rotate(180deg);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 35;
    transition: opacity 0.3s ease;
}

@media (min-width: 1024px) {
    .sidebar-overlay {
        display: none !important;
    }
}

/* Tablet adjustments */
@media (max-width: 1023px) and (min-width: 768px) {
    .app-main {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Mobile adjustments */
@media (max-width: 767px) {
    .app-main {
        padding-top: 4rem;
    }
    
    .sidebar-footer p {
        display: none;
    }
}

/* ===== Pedido Page Specific Adjustments ===== */
body.pedido-page .pedido-wrapper {
        max-width: 72rem; /* ~1152px (tailwind max-w-6xl) */
}
body.pedido-page .pedido-wrapper form > section {
        transition: box-shadow .2s ease, transform .2s ease;
}
body.pedido-page .pedido-wrapper form > section:hover {
        box-shadow: 0 4px 20px -4px rgba(15,23,42,.12), 0 0 0 1px rgba(99,102,241,0.05);
        transform: translateY(-2px);
}
body.pedido-page .pedido-wrapper h2 i { flex-shrink:0; }
body.pedido-page .pedido-wrapper .shadow-card { box-shadow: 0 2px 4px -2px rgba(15,23,42,.12), 0 1px 3px rgba(15,23,42,.08); }
body.pedido-page .pedido-wrapper .space-y-4 > :last-child { margin-bottom:0; }

/* Compact inputs inside pedido sections */
body.pedido-page input[type=text],
body.pedido-page input[type=number],
body.pedido-page input[type=date],
body.pedido-page select, body.pedido-page textarea {
        font-size: .75rem; /* tighten */
}

/* Accordion triggers */
body.pedido-page .accordion-trigger {
    background: linear-gradient(to right, #ffffff, #f8fafc);
    font-weight: 600;
    font-size: .7rem;
    letter-spacing: .5px;
    text-transform: uppercase;
    border-bottom: 1px solid #e2e8f0;
}
body.dark.pedido-page .accordion-trigger { background: linear-gradient(to right, #1e293b, #0f172a); border-bottom-color:#334155; }
body.pedido-page .accordion-trigger:hover { background:#f1f5f9; }
body.dark.pedido-page .accordion-trigger:hover { background:#243045; }
body.pedido-page .accordion-trigger[aria-expanded="true"] { background:#eef2ff; }
body.dark.pedido-page .accordion-trigger[aria-expanded="true"] { background:#1e293b; }
body.pedido-page .accordion-content { animation: fadeIn .25s ease; }
body.pedido-page .accordion-content.hidden { display:none; }

@media (max-width: 640px){
    body.pedido-page .accordion-trigger { padding:.5rem .75rem; font-size:.65rem; }
}

@media (min-width: 1280px){
    body.pedido-page .pedido-wrapper { padding-left: 2rem; padding-right: 2rem; }
}

@media (max-width: 640px){
    body.pedido-page .pedido-wrapper form > section { padding:1rem 1rem 1.25rem; }
    body.pedido-page .pedido-wrapper h2 { font-size:.75rem; }
    body.pedido-page .pedido-wrapper input, body.pedido-page .pedido-wrapper select { font-size:.7rem; }
}
