/* === RESET & BASE === */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5; color: #333; line-height: 1.6;
}
.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

/* === LOGIN PAGE === */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-container { width: 100%; max-width: 420px; padding: 20px; }
.login-card {
    background: white; border-radius: 16px; padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-header { text-align: center; margin-bottom: 30px; }
.login-header h1 { font-size: 3em; margin-bottom: 5px; }
.login-header h2 { color: #333; font-size: 1.4em; margin-bottom: 5px; }
.login-header p { color: #6c757d; font-size: 0.9em; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; margin-bottom: 6px; font-weight: 600; color: #495057; }
.login-form input {
    width: 100%; padding: 12px 15px; border: 2px solid #dee2e6; border-radius: 10px;
    font-size: 1em; transition: border-color 0.3s;
}
.login-form input:focus { outline: none; border-color: #667eea; }
.btn-block { width: 100%; padding: 14px; font-size: 1.1em; }

/* === NAVBAR === */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px 0; box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    position: sticky; top: 0; z-index: 1000;
}
.nav-container { display: flex; justify-content: space-between; align-items: center; }
.nav-brand h1 { color: white; font-size: 1.3em; margin: 0; }
.nav-toggle {
    display: none; background: rgba(255,255,255,0.2); border: none; color: white;
    font-size: 1.5em; padding: 5px 12px; border-radius: 8px; cursor: pointer;
}
.nav-menu { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav-link {
    color: white; text-decoration: none; padding: 8px 12px; border-radius: 6px;
    font-weight: 500; transition: all 0.2s; background: rgba(255,255,255,0.08);
    font-size: 0.85em; white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,0.2); }
.nav-link-sm { padding: 6px 10px; font-size: 0.8em; }
.nav-link-logout { background: rgba(220,53,69,0.3); }
.nav-link-logout:hover { background: rgba(220,53,69,0.5); }
.nav-user { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.user-badge {
    color: white; padding: 5px 12px; border-radius: 15px; font-size: 0.8em;
    font-weight: 600; background: rgba(255,255,255,0.15);
}
.user-badge.admin { background: rgba(255,193,7,0.3); }
.user-badge.editor { background: rgba(40,167,69,0.3); }

/* === SEARCH BAR === */
.search-container {
    background: white; padding: 15px 0; box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
#search-input {
    width: 100%; padding: 12px 15px; font-size: 1em; border: 2px solid #dee2e6;
    border-radius: 8px; transition: border-color 0.3s;
}
#search-input:focus { outline: none; border-color: #667eea; }
#search-results { margin-top: 10px; max-height: 400px; overflow-y: auto; }
.search-result-item {
    padding: 12px 15px; border-bottom: 1px solid #eee; cursor: pointer;
    transition: background 0.2s;
}
.search-result-item:hover { background: #f8f9fa; }
.search-result-ref { font-weight: bold; color: #667eea; }
.search-result-location { color: #6c757d; font-size: 0.85em; margin-top: 3px; }

/* === ALERTS === */
.alert {
    padding: 12px 18px; border-radius: 8px; margin: 10px 0; cursor: pointer;
    transition: opacity 0.3s;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* === BUTTONS === */
.btn {
    padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer;
    font-size: 0.95em; transition: all 0.2s; font-weight: 500;
    text-decoration: none; display: inline-block;
}
.btn-primary { background: #667eea; color: white; }
.btn-primary:hover { background: #5568d3; transform: translateY(-1px); }
.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover { background: #5a6268; }
.btn-danger { background: #dc3545; color: white; }
.btn-danger:hover { background: #c82333; }
.btn-sm { padding: 5px 10px; font-size: 0.85em; }

/* === DASHBOARD === */
.dashboard h1 { margin-bottom: 25px; color: #333; }
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px; margin-bottom: 30px;
}
.stat-card {
    background: white; border-radius: 12px; padding: 25px; text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); transition: transform 0.2s;
    border-left: 4px solid #667eea;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card.stat-success { border-left-color: #28a745; }
.stat-card.stat-empty { border-left-color: #adb5bd; }
.stat-icon { font-size: 2em; margin-bottom: 8px; }
.stat-value { font-size: 2.2em; font-weight: bold; color: #333; }
.stat-label { color: #6c757d; font-size: 0.9em; margin-top: 5px; }

.quick-actions { margin-top: 30px; }
.quick-actions h2 { margin-bottom: 15px; }
.actions-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}
.action-card {
    background: white; border-radius: 12px; padding: 25px; text-align: center;
    text-decoration: none; color: #333; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.2s; border: 2px solid transparent;
}
.action-card:hover {
    border-color: #667eea; transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.action-icon { font-size: 2em; display: block; margin-bottom: 8px; }

/* === FORMS === */
.form-page h1 { margin-bottom: 20px; }
.form-card {
    background: white; border-radius: 12px; padding: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: #495057; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border: 2px solid #dee2e6; border-radius: 8px;
    font-size: 0.95em; transition: border-color 0.3s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: #667eea;
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; }
.form-preview {
    background: #e9ecef; padding: 12px 18px; border-radius: 8px; margin-bottom: 18px;
    font-size: 1.1em;
}
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* === TABLES === */
.products-table { overflow-x: auto; }
.products-table table { width: 100%; border-collapse: collapse; background: white; border-radius: 12px; overflow: hidden; }
.products-table th {
    background: #343a40; color: white; padding: 12px 15px; text-align: left;
    font-weight: 600; font-size: 0.9em;
}
.products-table td { padding: 10px 15px; border-bottom: 1px solid #eee; }
.products-table tr:hover { background: #f8f9fa; }
.actions-cell { white-space: nowrap; display: flex; gap: 5px; }

/* === LOCATION DETAIL === */
.location-page .page-header { margin-bottom: 25px; }
.location-page .page-header h1 { font-size: 2em; }
.location-page .page-header p { color: #6c757d; font-size: 1.1em; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.empty-state { text-align: center; padding: 40px; background: #f8f9fa; border-radius: 12px; }

/* === USERS PAGE === */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.role-badge {
    padding: 4px 12px; border-radius: 15px; font-size: 0.85em; font-weight: 600;
}
.role-badge.admin { background: #fff3cd; color: #856404; }
.role-badge.editor { background: #d4edda; color: #155724; }
.role-badge.visualizador { background: #d1ecf1; color: #0c5460; }
.status-badge { padding: 3px 10px; border-radius: 10px; font-size: 0.8em; }
.status-badge.active { background: #d4edda; color: #155724; }
.status-badge.inactive { background: #f8d7da; color: #721c24; }
.roles-info { background: white; padding: 25px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.roles-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin-top: 15px; }
.role-card { padding: 20px; border-radius: 10px; background: #f8f9fa; }
.role-card h4 { margin-bottom: 8px; }

/* === IMPORT PAGE === */
.import-info { margin: 20px 0; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px; margin-top: 10px; }
.info-card { background: #f8f9fa; padding: 20px; border-radius: 10px; }
.info-card h4 { margin-bottom: 8px; }

/* === DANGER ZONE === */
.danger-zone {
    background: #fff5f5; border: 2px solid #dc3545; border-radius: 12px;
    padding: 25px; margin-top: 30px;
}
.danger-zone h3 { color: #dc3545; margin-bottom: 10px; }

/* === UTILITIES === */
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
main { padding: 25px 0; min-height: calc(100vh - 180px); }
footer { background: #343a40; color: white; padding: 15px 0; text-align: center; margin-top: 40px; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-menu {
        display: none; flex-direction: column; width: 100%;
        background: rgba(0,0,0,0.2); border-radius: 8px; padding: 10px; margin-top: 10px;
    }
    .nav-menu.active { display: flex; }
    .nav-user { margin-left: 0; margin-top: 8px; justify-content: center; }
    .nav-container { flex-wrap: wrap; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
}
