/* ========================================
   SISTEMA DE INVENTÁRIO INTELIGENTE
   CSS Completo e Responsivo
   ======================================== */

/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --secondary: #6c757d;
    --success: #2ecc71;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --white: #ffffff;
    --text: #333333;
    --text-muted: #6c757d;
    --border: #dee2e6;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
    --radius: 8px;
    --sidebar-width: 260px;
    --header-height: 60px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: #f5f6fa;
}

/* Layout Principal */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark);
    color: var(--white);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition);
    z-index: 1000;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: bold;
}

.logo i {
    color: var(--primary);
    font-size: 24px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 20px;
    cursor: pointer;
}

.sidebar-nav ul {
    list-style: none;
    padding: 10px 0;
}

.sidebar-nav li {
    margin: 2px 0;
}

.sidebar-nav li.nav-section {
    padding: 15px 20px 5px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.sidebar-nav a:hover,
.sidebar-nav li.active a {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}

.sidebar-nav li.active a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
}

.sidebar-nav i {
    width: 20px;
    text-align: center;
}

.sidebar-nav .badge {
    margin-left: auto;
    background: var(--danger);
    color: var(--white);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark);
}

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

.notifications {
    position: relative;
}

.notification-btn {
    position: relative;
    color: var(--text-muted);
    font-size: 18px;
    text-decoration: none;
}

.notification-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: var(--white);
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 50%;
}

.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.user-avatar {
    width: 35px;
    height: 35px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.user-name {
    font-weight: 500;
    color: var(--text);
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    margin-top: 10px;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-header {
    padding: 15px;
    border-bottom: 1px solid var(--border);
}

.dropdown-header strong {
    display: block;
    color: var(--dark);
}

.dropdown-header small {
    color: var(--text-muted);
    font-size: 12px;
}

.role-badge {
    display: inline-block;
    margin-top: 5px;
    padding: 2px 8px;
    background: var(--primary);
    color: var(--white);
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 5px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: var(--light);
}

.dropdown-item.text-danger {
    color: var(--danger);
}

/* Page Content */
.page-content {
    flex: 1;
    padding: 25px;
}

.main-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h3 i {
    color: var(--primary);
}

.card-body {
    padding: 20px;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert .close-btn {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.5;
}

.alert .close-btn:hover {
    opacity: 1;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.stat-card.success { border-left-color: var(--success); }
.stat-card.danger { border-left-color: var(--danger); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.info { border-left-color: var(--info); }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(52, 152, 219, 0.1);
    color: var(--primary);
}

.stat-card.success .stat-icon { background: rgba(46, 204, 113, 0.1); color: var(--success); }
.stat-card.danger .stat-icon { background: rgba(231, 76, 60, 0.1); color: var(--danger); }
.stat-card.warning .stat-icon { background: rgba(243, 156, 18, 0.1); color: var(--warning); }
.stat-card.info .stat-icon { background: rgba(23, 162, 184, 0.1); color: var(--info); }

.stat-info h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
}

.stat-info p {
    color: var(--text-muted);
    font-size: 13px;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.chart-card {
    min-height: 300px;
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

/* Activity List */
.activity-list {
    list-style: none;
}

.activity-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}

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

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light);
    color: var(--primary);
    flex-shrink: 0;
}

.activity-item.critico .activity-icon { background: rgba(231, 76, 60, 0.1); color: var(--danger); }
.activity-item.expirado .activity-icon { background: rgba(231, 76, 60, 0.1); color: var(--danger); }
.activity-item.prestes_expirar .activity-icon { background: rgba(243, 156, 18, 0.1); color: var(--warning); }

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 3px;
}

.activity-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-muted);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

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

.data-table th {
    background: var(--light);
    font-weight: 600;
    color: var(--dark);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: rgba(52, 152, 219, 0.02);
}

.data-table .actions {
    white-space: nowrap;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.badge-bom, .badge-success { background: rgba(46, 204, 113, 0.1); color: var(--success); }
.badge-regular, .badge-warning { background: rgba(243, 156, 18, 0.1); color: var(--warning); }
.badge-mau, .badge-danger { background: rgba(231, 76, 60, 0.1); color: var(--danger); }
.badge-leilao, .badge-info { background: rgba(23, 162, 184, 0.1); color: var(--info); }
.badge-administrador { background: rgba(231, 76, 60, 0.1); color: var(--danger); }
.badge-gestor { background: rgba(243, 156, 18, 0.1); color: var(--warning); }
.badge-utilizador { background: rgba(52, 152, 219, 0.1); color: var(--primary); }

.badge-alert-critico { background: var(--danger); color: var(--white); }
.badge-alert-expirado { background: var(--danger); color: var(--white); }
.badge-alert-prestes_expirar { background: var(--warning); color: var(--white); }
.badge-alert-alerta { background: var(--warning); color: var(--white); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

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

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

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

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

.btn-light {
    background: var(--light);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group input.bg-light,
.form-group select.bg-light,
.form-group textarea.bg-light {
    background: var(--light);
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.form-section h4 {
    margin-bottom: 20px;
    color: var(--dark);
    font-size: 16px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

/* Filters */
.filters-card {
    background: var(--light);
}

.filters-form .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: end;
}

.filters-form .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
}

/* Page Actions */
.page-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Progress Bar */
.progress-bar {
    height: 20px;
    background: var(--light);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 11px;
    font-weight: 600;
    transition: width 0.3s ease;
}

/* Auth Pages */
.auth-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo {
    width: 80px;
    height: 80px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 20px;
}

.auth-header h1 {
    font-size: 24px;
    color: var(--dark);
    margin-bottom: 10px;
}

.auth-header p {
    color: var(--text-muted);
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--dark);
    font-weight: 500;
}

.password-input {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 13px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.forgot-link {
    color: var(--primary);
    text-decoration: none;
}

.auth-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
}

.security-badges {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.security-badges i {
    color: var(--success);
}

/* Detail Pages */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.detail-title h2 {
    font-size: 24px;
    margin-bottom: 5px;
}

.detail-actions {
    display: flex;
    gap: 10px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}

.detail-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-item label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item value {
    font-size: 16px;
    font-weight: 500;
    color: var(--dark);
}

.detail-item.highlight value {
    font-size: 20px;
    color: var(--primary);
}

.info-box {
    background: var(--light);
    padding: 20px;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.info-box h4 {
    margin-bottom: 10px;
    color: var(--dark);
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.info-row:last-child {
    border-bottom: none;
}

/* Timeline */
.timeline {
    list-style: none;
    padding-left: 30px;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 25px;
}

.timeline-icon {
    position: absolute;
    left: -30px;
    width: 20px;
    height: 20px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.timeline-content {
    background: var(--light);
    padding: 15px;
    border-radius: var(--radius);
}

.timeline-content h4 {
    font-size: 14px;
    margin-bottom: 5px;
}

.timeline-meta {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: var(--white);
    margin: 10% auto;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

/* Reports Grid */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.report-card {
    text-align: center;
}

.report-card .card-header {
    flex-direction: column;
    gap: 15px;
    padding: 30px 20px;
}

.report-card .card-header i {
    font-size: 48px;
    color: var(--primary);
}

.report-card .card-header h3 {
    font-size: 18px;
}

.report-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

/* Depreciation Circle */
.depreciation-chart {
    display: flex;
    align-items: center;
    gap: 30px;
}

.progress-circle {
    position: relative;
    width: 120px;
    height: 120px;
}

.progress-circle svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.circle-bg {
    fill: none;
    stroke: var(--light);
    stroke-width: 3;
}

.circle {
    fill: none;
    stroke: var(--primary);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}

.percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: var(--dark);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Print */
@media print {
    .sidebar,
    .top-header,
    .page-actions,
    .btn {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.mb-4 { margin-bottom: 20px; }
.d-inline { display: inline; }
.d-flex { display: flex; }
.img-fluid { max-width: 100%; height: auto; }
.rounded { border-radius: var(--radius); }
.preview-img { max-width: 200px; max-height: 200px; object-fit: cover; }
.empty-state { text-align: center; color: var(--text-muted); padding: 40px; font-style: italic; }
.pagination { display: flex; gap: 5px; justify-content: center; margin-top: 20px; }
.stats-row { display: flex; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-box { background: var(--white); padding: 20px; border-radius: var(--radius); text-align: center; min-width: 120px; box-shadow: var(--shadow); }
.stat-box h4 { font-size: 24px; color: var(--dark); margin-bottom: 5px; }
.stat-box p { color: var(--text-muted); font-size: 12px; }
.stat-box.success h4 { color: var(--success); }
.alert-row { transition: background 0.3s; }
.alert-row.unread { background: rgba(52, 152, 219, 0.05); }
.alert-row.alert-critico { border-left: 3px solid var(--danger); }
.alert-row.alert-expirado { border-left: 3px solid var(--danger); }
.alert-row.alert-prestes_expirar { border-left: 3px solid var(--warning); }
.forecast-info { display: flex; gap: 30px; margin-bottom: 20px; padding: 15px; background: var(--light); border-radius: var(--radius); }
.forecast-item { display: flex; flex-direction: column; }
.forecast-item .label { font-size: 12px; color: var(--text-muted); }
.forecast-item .value { font-size: 18px; font-weight: bold; color: var(--dark); }
.forecast-item .value.highlight { color: var(--danger); }