:root {
    --bg-color: #f8f6ff;
    --card-bg: #ffffff;
    --primary-color: #c39efd;
    /* Lilás do logo */
    --primary-hover: #b089f0;
    --secondary-color: #ff8dc7;
    /* Rosa do logo */
    --text-color: #4a3a6e;
    /* Roxo escuro para texto */
    --text-muted: #8e82a8;
    --border-color: #e6e0f3;
    --success-color: #69f0ff;
    /* Ciano do logo para sucesso/info */
    --danger-color: #ff6b6b;
    --accent-yellow: #ffeb3b;
    /* Amarelo do logo */
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
}

/* Header Modernizado */
header {
    background-color: rgba(255, 255, 255, 0.90);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(195, 158, 253, 0.2);
    padding: 0.5rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 10px 30px -10px rgba(74, 58, 110, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

@media (max-width: 1000px) {
    .header-content {
        gap: 12px;
        flex-direction: column;
        align-items: center;
    }

    nav {
        max-width: 100%;
        justify-content: flex-start;
        padding-bottom: 8px;
    }

    .logo {
        text-align: center;
        display: flex;
        justify-content: center;
    }

    .logo-img {
        height: 40px !important;
    }
}

.logo {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
}

.logo-img {
    height: 40px;
    width: auto;
    border-radius: 8px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo:hover .logo-img {
    transform: scale(1.05) rotate(-2deg);
}

/* Nav Improvements */
nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 4px;
    max-width: 100%;
}

nav a,
.dropbtn {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.85rem;
    white-space: nowrap;
    padding: 8px 14px;
    border-radius: 20px; /* Pill shape */
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
}

nav a span, .dropbtn span {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

nav a:hover, .dropbtn:hover {
    background-color: var(--card-bg);
    color: var(--primary-color);
    border-color: rgba(195, 158, 253, 0.4);
    box-shadow: 0 4px 12px rgba(195, 158, 253, 0.15);
    transform: translateY(-1px);
}

nav a:hover span, .dropbtn:hover span {
    transform: scale(1.15);
}

nav a.active, .dropbtn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 15px rgba(195, 158, 253, 0.35);
}

nav a.active span, .dropbtn.active span {
    filter: brightness(1.2);
}

/* Dropdown specific styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--card-bg);
    min-width: 160px;
    box-shadow: 0 10px 30px rgba(74, 58, 110, 0.15);
    border-radius: 12px;
    z-index: 1001;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    padding: 8px 0;
}

/* Show on hover for desktop */
@media (min-width: 769px) {
    .dropdown:hover .dropdown-content {
        display: flex;
        flex-direction: column;
        opacity: 1;
        transform: translateX(-50%) translateY(5px);
    }
}

/* Show on click for all (handled by JS adding .open class) */
.dropdown.open .dropdown-content {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateX(-50%) translateY(5px);
}

.dropdown-content a {
    color: var(--text-color);
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    border-radius: 0;
    box-shadow: none;
    border: none;
    background: none;
    transform: none;
}

.dropdown-content a:hover {
    background-color: rgba(195, 158, 253, 0.1);
    color: var(--primary-color);
    border: none;
    box-shadow: none;
    transform: none;
}

.dropdown-content a.active {
    background-color: rgba(195, 158, 253, 0.15);
    color: var(--primary-color);
    font-weight: 700;
    border-left: 3px solid var(--primary-color);
    box-shadow: none;
}


@media (max-width: 768px) {
    nav {
        padding: 0 4px 10px 4px;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
        -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
    }
    
    nav::-webkit-scrollbar {
        display: none;
    }

    nav a {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* Buttons - Responsive sizing */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px -1px rgba(195, 158, 253, 0.3);
}

@media (max-width: 768px) {
    .btn {
        padding: 0.85rem 1.25rem;
        font-size: 0.95rem;
        width: 100%;
        /* Full width buttons on mobile usually feel better */
    }
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(195, 158, 253, 0.4);
}

.btn-secondary {
    background-color: var(--text-muted);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--text-color);
}

/* Responsive Venda Layout */
.venda-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: start;
}

@media (min-width: 992px) {
    .venda-layout {
        display: grid;
        grid-template-columns: 1fr 1.5fr;
        gap: 2rem;
    }
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 2px solid var(--border-color);
    padding: 2.5rem;
    margin-bottom: 2.5rem;
}

@media (max-width: 768px) {
    .card {
        padding: 1.5rem;
    }
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    margin-top: 2.5rem;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.dashboard-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 12px;
    text-align: center;
    border: 2px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .dashboard-card {
        padding: 1.5rem;
    }
}

.dashboard-card:hover {
    border-color: var(--primary-color);
    transform: scale(1.02);
    box-shadow: 0 12px 20px -5px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on mobile if possible */
        gap: 12px;
    }

    .dashboard-icon {
        font-size: 2.5rem;
        margin-bottom: 0.75rem;
    }

    .dashboard-card {
        padding: 1.25rem !important;
    }

    .dashboard-card h3 {
        font-size: 0.9rem !important;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Forms */
input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1.1rem;
    margin-top: 0.5rem;
    box-sizing: border-box;
}

input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background-color: #f8fafc;
    padding: 1.25rem 1rem;
    border-bottom: 2px solid var(--border-color);
    font-weight: 700;
}

td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Responsive Table into Cards */
@media (max-width: 768px) {

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        border: 2px solid var(--border-color);
        margin-bottom: 1rem;
        border-radius: 10px;
        background: white;
    }

    td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
        text-align: right;
    }

    /* Labels dinâmicos via data-label para evitar hardcode no CSS */
    td:before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 700;
        color: var(--text-muted);
    }
}

/* Alerts */
.alert {
    padding: 1.25rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    font-weight: 600;
    border-left: 5px solid transparent;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
    border-left-color: #22c55e;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-left-color: #ef4444;
}

/* Search Bar (New) */
.search-container {
    margin-bottom: 1.5rem;
    position: relative;
}

.search-input {
    padding-left: 3rem !important;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: var(--text-muted);
}

@media (max-width: 480px) {
    .card {
        padding: 1.25rem;
    }

    h1 {
        font-size: 1.8rem;
    }

    .btn {
        padding: 1rem;
    }
}