:root {
    --primary-red: #E53935;
    --primary-blue: #0D47A1;
    --bg-light: #F8F9FE;
    --sidebar-bg: #FFFFFF;
    --text-dark: #2D3436;
    --text-muted: #636E72;
    --accent-blue: #E3F2FD;
    --accent-red: #FFEBEE;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --border-color: #E0E6ED;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 3rem;
}

.logo-icon {
    background: linear-gradient(135deg, var(--primary-red), var(--primary-blue));
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
    box-shadow: 0 5px 15px rgba(229, 57, 53, 0.3);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.logo-text span {
    color: var(--primary-red);
}

.nav-menu {
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 12px;
    margin-bottom: 8px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item i {
    font-size: 1.2rem;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--accent-blue);
    color: var(--primary-blue);
}

.nav-item.active {
    background-color: var(--primary-blue);
    color: white;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 15px;
    margin-top: auto;
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info .user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-info .user-role {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Main Content Styling */
.main-content {
    flex: 1;
    padding: 2rem 3rem;
    max-width: 1400px;
    margin: 0 auto;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.search-bar {
    background: white;
    padding: 10px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 400px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.search-bar input {
    border: none;
    outline: none;
    width: 100%;
    font-family: inherit;
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-red);
    color: white;
}

.btn-primary:hover {
    background-color: #C62828;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(229, 57, 53, 0.2);
}

.btn-secondary {
    background-color: white;
    color: var(--primary-blue);
    border: 1px solid var(--primary-blue) !important;
}

.btn-secondary:hover {
    background-color: var(--accent-blue);
    transform: translateY(-2px);
}

.notification-btn {
    background: white;
    border: 1px solid var(--border-color);
    width: 45px;
    height: 45px;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    color: var(--text-muted);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary-red);
    color: white;
    font-size: 0.7rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Stats Cards */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    border: 1px solid transparent;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-blue);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.red { background: var(--accent-red); color: var(--primary-red); }
.stat-icon.blue { background: var(--accent-blue); color: var(--primary-blue); }
.stat-icon.orange { background: #FFF3E0; color: #EF6C00; }

.stat-details h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-details p {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Panels */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}

.panel {
    background: white;
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.panel-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.view-all {
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Rupture Item Styling */
.rupture-item {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    border-left: 4px solid var(--primary-red);
}

.rupture-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.rupture-product { font-weight: 700; color: var(--text-dark); }
.rupture-store { font-size: 0.8rem; color: var(--text-muted); }
.rupture-time { font-size: 0.75rem; color: var(--primary-red); font-weight: 600; }

.rupture-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.7rem;
    border-radius: 6px;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
    font-size: 0.9rem;
}

/* Store List Table */
.store-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
}

.store-list::-webkit-scrollbar { width: 4px; }
.store-list::-webkit-scrollbar-track { background: transparent; }
.store-list::-webkit-scrollbar-thumb { background: #eee; border-radius: 10px; }

.store-card {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 20px;
    padding: 12px 15px;
    border-radius: 15px;
    background: var(--bg-light);
    transition: var(--transition);
}

.store-card:hover {
    background: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.03);
    transform: scale(1.01);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-indicator.visited { background-color: #4CAF50; }
.status-indicator.pending { background-color: #FFC107; }
.status-indicator.overdue { 
    background-color: var(--primary-red); 
    box-shadow: 0 0 10px rgba(229, 57, 53, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.store-name { font-weight: 600; }
.network-tag {
    font-size: 0.7rem;
    background: var(--accent-blue);
    color: var(--primary-blue);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
    font-weight: 700;
}
.store-date { color: var(--text-muted); font-size: 0.85rem; }

/* Product Checklist */
.checklist-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.checklist-search i { color: var(--text-muted); }
.checklist-search input { border: none; padding: 0; background: transparent; font-size: 0.85rem; }

.product-checklist {
    max-height: 250px;
    overflow-y: auto;
    padding: 5px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 10px; /* Quadrado próximo da palavra */
    padding: 6px 10px; /* Altura menor para visual clean */
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.checklist-item:hover {
    background-color: var(--bg-light);
}

.checklist-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checklist-item label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer; /* Permite clicar no texto para marcar */
    flex: 1; /* Ocupa o resto da linha */
}

.checklist-item:last-child { border-bottom: none; }

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    position: relative;
    max-height: 90vh; /* Ocupa no máximo 90% da altura da tela */
    overflow-y: auto; /* Adiciona rolagem se o conteúdo for maior que a tela */
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease-out;
}

.modal-content.small { max-width: 450px; }

/* Custom Scrollbar para o Modal */
.modal-content::-webkit-scrollbar { width: 6px; }
.modal-content::-webkit-scrollbar-track { background: transparent; }
.modal-content::-webkit-scrollbar-thumb { background: #eee; border-radius: 10px; }

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.close-modal {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

select, textarea, input {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-family: inherit;
}

.btn-success {
    background-color: var(--primary-blue);
    color: white;
    width: 100%;
    justify-content: center;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .sidebar { width: 80px; padding: 1.5rem 0.5rem; }
    .logo-text, .nav-item span, .user-info { display: none; }
    .nav-item { justify-content: center; }
}

/* Reports Table Styling */
.reports-container {
    overflow-x: auto;
    margin-top: 20px;
}

.reports-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.reports-table th, .reports-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--bg-light);
}

.reports-table th {
    background-color: var(--bg-light);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.badge-rupture {
    background: #ffebee;
    color: var(--primary-red);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.8rem;
}

.notes-cell {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-muted);
}

.nav-item.active {
    background: rgba(0, 71, 171, 0.1);
    color: var(--primary-blue);
    border-left: 4px solid var(--primary-blue);
}


/* Full Store and Product Views */
.store-grid-full {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.store-card-full {
    background: white;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.store-main-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.store-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Status Tags */
.status-tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-tag.ok { background: #e8f5e9; color: #2e7d32; }
.status-tag.warning { background: #ffebee; color: var(--primary-red); }

/* Modal Details */
.modal-detail {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content.small {
    width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.detail-list {
    list-style: none;
    padding: 0;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--bg-light);
}


/* Notifications Dropdown */
.notification-wrapper {
    position: relative;
}

.notification-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
    display: none;
    flex-direction: column;
    z-index: 1500;
    overflow: hidden;
}

.notification-dropdown.active {
    display: flex;
}

.notification-header {
    padding: 15px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h3 { font-size: 0.9rem; margin: 0; }

.btn-clear {
    background: none;
    border: none;
    color: var(--primary-blue);
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 600;
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 15px;
    border-bottom: 1px solid var(--bg-light);
    display: flex;
    gap: 12px;
    transition: var(--transition);
}

.notification-item:hover { background: #f9f9f9; }

.notification-item i {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.noti-red { background: #ffebee; color: var(--primary-red); }
.noti-blue { background: #e3f2fd; color: var(--primary-blue); }
.noti-orange { background: #fff3e0; color: #fb8c00; }

.noti-content p { margin: 0; font-size: 0.85rem; }
.noti-content .noti-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }


/* Ranking and Critical List Styles */
.ranking-list, .critical-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.critical-list {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

.ranking-item, .critical-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: var(--bg-light);
    border-radius: 10px;
    transition: var(--transition);
}

.ranking-item:hover, .critical-item:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.rank-number {
    width: 30px;
    height: 30px;
    background: var(--primary-blue);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.rank-info, .critical-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.rank-info strong, .critical-info strong {
    font-size: 0.85rem;
    color: var(--text-dark);
}

.rank-info span, .critical-info span {
    font-size: 0.75rem;
    color: var(--text-muted);
}


/* Login Screen */
.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #f0f2f5;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    display: flex;
    width: 900px;
    height: 550px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.login-image-side {
    flex: 1.2;
    background: var(--primary-blue);
    position: relative;
    overflow: hidden;
}

.login-image-side img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
}

.login-form-side {
    flex: 1;
    padding: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-header {
    margin-bottom: 30px;
}

.login-header h2 {
    font-size: 1.8rem;
    color: var(--text-dark);
    margin: 10px 0 5px 0;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 15px;
    color: var(--primary-blue);
}

.input-with-icon input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: var(--transition);
}

.input-with-icon input:focus {
    border-color: var(--primary-blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 71, 171, 0.1);
}

.btn-full {
    width: 100%;
    padding: 14px;
    margin-top: 20px;
    font-size: 1rem;
}

.error-msg {
    color: var(--primary-red);
    font-size: 0.85rem;
    margin-top: 15px;
    text-align: center;
}


/* Updated Login Background Layout */
.login-overlay {
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url('login-bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    text-align: center;
}

.login-card .logo-text {
    justify-content: center;
    margin-bottom: 20px;
}


/* Sidebar User Profile Updates */
.avatar {
    width: 45px;
    height: 45px;
    background: var(--primary-blue);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.logout-btn {
    margin: 10px 20px 20px 20px;
    padding: 12px;
    background: #fff0f0;
    border: none;
    border-radius: 12px;
    color: var(--primary-red);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    font-size: 0.9rem;
}

.logout-btn:hover {
    background: var(--primary-red);
    color: white;
}


/* Photo Upload Styles */
.photo-upload-container {
    margin-bottom: 10px;
}

.photo-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.photo-upload-label:hover {
    border-color: var(--primary-blue);
    background: #eef2f7;
}

.photo-upload-label i { font-size: 1.5rem; color: var(--primary-blue); }
.photo-upload-label span { font-size: 0.85rem; font-weight: 600; color: var(--text-dark); }

.photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eee;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* History Photo Gallery */
.history-photos {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.history-photo-thumb {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

.history-photo-thumb:hover {
    transform: scale(1.1);
}


/* Global Utilities */
.text-red { color: var(--primary-red) !important; }
.btn-icon:hover.text-red { background: #fff0f0; }


/* Flicker Fix */
.login-overlay, .app-container {
    display: none;
}

body.not-logged-in .login-overlay {
    display: flex !important;
}

body.logged-in .app-container {
    display: flex !important;
}


/* Bulk Actions */
.btn-danger {
    background: var(--primary-red);
    color: white;
}

.btn-danger:hover {
    background: #c62828;
    box-shadow: 0 5px 15px rgba(229, 57, 53, 0.3);
}


/* Editable Date Styles */
.editable-date {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-edit-small {
    background: #f0f4f8;
    border: none;
    border-radius: 6px;
    padding: 4px 6px;
    color: var(--primary-blue);
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition);
}

.btn-edit-small:hover {
    background: var(--primary-blue);
    color: white;
}


/* Report Filters */
.header-filters {
    display: flex;
    gap: 15px;
    align-items: center;
}

.filter-select {
    padding: 10px 15px;
    border: 1px solid #eee;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    color: var(--text-dark);
    background: #f8f9fa;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

.filter-select:hover {
    border-color: var(--primary-blue);
    background: white;
}

