/* --- 1. IMPORTAÇÃO DE FONTES E DEFINIÇÃO DE VARIÁVEIS --- */
@import url('../../shared/base.css');

:root {
    --bg: #f0f2f5;
    --surface: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 2px 8px rgba(0,0,0,0.07);

    --primary: #2563eb;
    --secondary: #3b82f6;
    --accent: #f59e0b;
    --success: #10b981;
    --error: #ef4444;
    --white: #ffffff;

    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --transition: 0.3s ease;
}

/* --- 2. ESTILOS GERAIS E RESET --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font);
    line-height: 1.6;
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

/* --- 3. CABEÇALHO E MENU HAMBÚRGUER --- */
.header {
    background: var(--primary);
    color: var(--white);
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header h1 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    text-align: center;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}
.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 1001;
    position: absolute;
}
.hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--white);
    border-radius: 3px;
    transition: all 0.3s ease-in-out;
}
.hamburger-btn.is-open span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.hamburger-btn.is-open span:nth-child(2) { opacity: 0; }
.hamburger-btn.is-open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* --- 4. LAYOUT PRINCIPAL, SIDEBAR E OVERLAY --- */
.container { display: flex; }
.main-content { width: 100%; padding: 1.5rem; max-width: 1200px; margin: 0 auto; }
.sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--bg);
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.sidebar.is-open { left: 0; }
.overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition);
}
.overlay.is-active { opacity: 1; visibility: visible; }

/* --- 5. ESTILOS DO SIDEBAR --- */
.sidebar-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    padding-top: 5rem; /* Space for status bar */
}
.sidebar-title {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.sidebar nav {
    padding: 1rem;
    flex-grow: 1;
}
.sidebar nav ul { list-style: none; }

.menu-section-title {
    display: block;
    padding: 1.5rem 0.5rem 0.5rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
}

.menu-item {
    display: flex;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.8rem;
    transition: all var(--transition);
    box-shadow: var(--shadow);
    cursor: pointer;
}
.menu-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37,99,235,0.15);
    border-color: var(--primary);
}
.menu-item.active {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.menu-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.menu-item-content h4 {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.2rem;
    line-height: 1.3;
}
.menu-item.active .menu-item-content h4 {
    color: var(--primary);
}

.menu-item-content p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.4;
    margin: 0;
}

/* --- 6. ESTILOS DE COMPONENTES --- */
form, .info-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}
.saved-items-list {
    background: var(--surface);
    padding: 0 1.5rem 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}
h2, h3 {
    font-family: var(--font);
    font-weight: 700;
    color: var(--primary);
    margin-top: 0;
    margin-bottom: 1.5rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.2rem;
}
.saved-items-list h3 {
    padding-top: 1.5rem;
    text-align: left;
}
label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
}
input[type="text"], input[type="date"], textarea, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    font-family: var(--font);
    transition: border-color var(--transition), box-shadow var(--transition);
    margin-bottom: 1rem;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

/* --- BOTÕES --- */
.btn {
    width: 100%;
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    color: var(--white);
    font-weight: 600;
    transition: all var(--transition);
    margin-top: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(0.98); }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 4px 15px rgba(37,99,235,0.2);
}
.btn-primary:hover { box-shadow: 0 4px 20px rgba(37,99,235,0.3); }
.danger-btn {
    background: var(--error);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}
.danger-btn:hover { box-shadow: 0 4px 20px rgba(239, 68, 68, 0.3); }

/* Notificações e Listas */
.notification { padding: 1rem; margin-bottom: 1.5rem; border-radius: var(--radius-sm); color: var(--white); font-weight: bold; text-align: center; }
.notification.success { background-color: var(--success); }
.notification.error { background-color: var(--error); }
.saved-item {
    border-bottom: 1px solid var(--border);
    padding: 1rem 50px 1rem 0;
    position: relative;
}
.saved-item:last-child { border-bottom: none; }
.saved-item p { margin: 5px 0; word-break: break-word; font-size: 0.9rem; color: var(--text-secondary); }
.saved-item p strong { color: var(--text); }
.delete-btn {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    background-color: var(--error);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    line-height: 28px;
    text-align: center;
    padding: 0;
    transition: all 0.2s;
}
.delete-btn:hover { opacity: 0.8; transform: translateY(-50%) scale(1.1); }

/* --- Mapeamento de Roletes --- */
.conveyor-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 10px; background: var(--bg); padding: 15px; border-radius: var(--radius); }
.roller { color: var(--white); padding: 15px 5px; text-align: center; cursor: pointer; border-radius: 6px; font-weight: bold; font-size: 0.9rem; transition: all 0.2s ease; }
.roller:hover { transform: scale(1.05); filter: brightness(1.1); }
.roller-legend { display: flex; justify-content: center; gap: 20px; margin-top: 1.5rem; padding: 1rem; background-color: var(--bg); border-radius: var(--radius); flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 8px; font-weight: bold; }
.legend-color-box { width: 20px; height: 20px; border-radius: 4px; border: 1px solid var(--border); }
.ok { background-color: var(--success); }
.atencao { background-color: var(--accent); color: var(--white); }
.trocar { background-color: var(--error); }
.map-actions { display: flex; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; }
.map-actions .btn { flex-grow: 1; width: auto; }

/* --- 7. MEDIA QUERIES --- */
@media (min-width: 768px) {
    .hamburger-btn { display: none; }
    .header h1 { margin-left: 0; text-align: left; justify-content: flex-start; }
    .sidebar {
        position: static;
        transform: translateX(0);
        height: auto;
        min-height: calc(100vh - 70px); /* altura do header */
        flex-shrink: 0;
        width: 350px;
        background: var(--surface);
        backdrop-filter: none;
        padding-top: 1.5rem;
        border-right: 1px solid var(--border);
        box-shadow: none;
    }
    .sidebar.is-open { box-shadow: none; }
    .sidebar nav ul li strong { color: var(--text-secondary); }
    .sidebar nav ul li a { color: var(--text); }
    .sidebar nav ul li a:hover { background-color: var(--bg); color: var(--primary); }
    .sidebar nav ul li a.active { background-color: var(--primary); color: var(--white); }
    .main-content { padding: 2.5rem; }
    .btn { width: auto; }
    .overlay { display: none !important; }
    .map-actions .btn { flex-grow: 0; }
}
