/**
 * CSS Completo - Sistema de Inventário VstNet
 * css/styles.css
 */

/* ===================================
   RESET E BASE
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

/* ===================================
   GRADIENTES E CORES
   =================================== */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.table-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* ===================================
   CONTAINER E LAYOUT
   =================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===================================
   CARDS E COMPONENTES
   =================================== */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* ===================================
   BOTÕES
   =================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

/* ===================================
   FORMULÁRIOS
   =================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #374151;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-control:hover {
    border-color: #d1d5db;
    background: white;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ===================================
   GRID SYSTEM
   =================================== */
.grid {
    display: grid;
    gap: 24px;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* ===================================
   TABELAS
   =================================== */
.table-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

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

.table th {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 16px 20px;
    text-align: left;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    border-bottom: 2px solid #e5e7eb;
}

.table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* ===================================
   MODAIS
   =================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===================================
   STATUS BADGES
   =================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-ativo {
    background: #d1fae5;
    color: #065f46;
}

.status-inativo {
    background: #fee2e2;
    color: #991b1b;
}

.status-manutencao {
    background: #fef3c7;
    color: #92400e;
}

.status-descartado {
    background: #f3f4f6;
    color: #374151;
}

/* ===================================
   DRAG & DROP
   =================================== */
.drag-drop-area {
    border: 2px dashed #d1d5db;
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.drag-drop-area:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.drag-drop-area.dragover {
    border-color: #667eea;
    background: #e0e7ff;
    transform: scale(1.02);
}

/* ===================================
   PREVIEW DE IMAGENS
   =================================== */
.image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.image-preview-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.image-preview-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

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

.image-preview-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
}

.image-preview-item:hover .image-preview-remove {
    opacity: 1;
}

/* ===================================
   ESTATÍSTICAS
   =================================== */
.stats-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.stats-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.stats-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.stats-value {
    font-size: 32px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
}

.stats-label {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
    margin-top: 4px;
}

/* ===================================
   ALERTAS E TOASTS
   =================================== */
.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin: 16px 0;
    border: 1px solid transparent;
}

.alert-success {
    background: #d1fae5;
    border-color: #a7f3d0;
    color: #065f46;
}

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

.alert-warning {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1e40af;
}

/* ===================================
   LOADING E SPINNERS
   =================================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===================================
   FILTROS
   =================================== */
.filters-container {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    margin-bottom: 24px;
}

.filters-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 16px;
    align-items: end;
}

.search-input-container {
    position: relative;
}

.search-input {
    padding-left: 48px;
    background: #f8fafc;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    width: 20px;
    height: 20px;
}

/* ===================================
   FOOTER
   =================================== */
.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 0;
    border-radius: 16px;
    margin-top: 40px;
    text-align: center;
}

.footer-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
    margin: 24px 0;
}

.footer-stat {
    text-align: center;
}

.footer-stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.footer-stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* ===================================
   RESPONSIVIDADE
   =================================== */
@media (max-width: 1024px) {
    .grid-cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    
    .filters-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .footer-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .grid-cols-5,
    .grid-cols-4,
    .grid-cols-3,
    .grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-stats {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .table {
        min-width: 600px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .modal-content {
        margin: 10px;
        border-radius: 16px;
    }
    
    .stats-value {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .card,
    .modal-content {
        border-radius: 12px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .form-control {
        padding: 10px 12px;
    }
    
    .table th,
    .table td {
        padding: 12px 16px;
    }
    
    .stats-card {
        padding: 20px;
    }
}

/* ===================================
   IMPRESSÃO
   =================================== */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .card,
    .table-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .gradient-bg,
    .table-header {
        background: #f5f5f5 !important;
        color: black !important;
    }
    
    .btn {
        border: 1px solid #ddd;
        background: white;
        color: black;
    }
}

/* ===================================
   PRINT HEADER (OCULTO POR PADRÃO)
   =================================== */
.print-only {
    display: none;
}

.print-header {
    text-align: center;
    padding: 20px;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
}

.print-header h1 {
    font-size: 24px;
    margin-bottom: 10px;
}

.print-stats {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
}

/* ===================================
   UTILITÁRIOS
   =================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-sm { font-size: 14px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }
.text-4xl { font-size: 36px; }

.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-900 { color: #111827; }

.text-blue-600 { color: #2563eb; }
.text-blue-800 { color: #1e40af; }
.text-green-600 { color: #16a34a; }
.text-green-800 { color: #166534; }
.text-red-600 { color: #dc2626; }
.text-red-800 { color: #991b1b; }

.bg-white { background-color: white; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }

.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }
.rounded-xl { border-radius: 16px; }
.rounded-2xl { border-radius: 20px; }

.shadow { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); }
.shadow-xl { box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1); }

.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }

.p-2 { padding: 8px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.p-8 { padding: 32px; }

.px-4 { padding-left: 16px; padding-right: 16px; }
.px-6 { padding-left: 24px; padding-right: 24px; }
.px-8 { padding-left: 32px; padding-right: 32px; }

.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.py-6 { padding-top: 24px; padding-bottom: 24px; }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

.cursor-pointer { cursor: pointer; }
.transition-all { transition: all 0.3s ease; }

.opacity-75 { opacity: 0.75; }
.opacity-90 { opacity: 0.9; }

.border { border: 1px solid #e5e7eb; }
.border-2 { border: 2px solid #e5e7eb; }
.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }
.border-blue-100 { border-color: #dbeafe; }

.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }

/* ===================================
   ANIMAÇÕES ESPECIAIS
   =================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-slide-in-right {
    animation: slideInRight 0.4s ease-out;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===================================
   DARK MODE (OPCIONAL)
   =================================== */
@media (prefers-color-scheme: dark) {
    .auto-dark {
        background: #1f2937;
        color: #f9fafb;
    }
}

/* ===================================
   FOCUS STATES PARA ACESSIBILIDADE
   =================================== */
.btn:focus,
.form-control:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ===================================
   CUSTOMIZAÇÕES ESPECÍFICAS
   =================================== */
.inventory-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 32px;
    border-radius: 16px;
    margin-bottom: 32px;
}

.inventory-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.feature-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #6b7280;
}

.feature-list li::before {
    content: "✓";
    color: #10b981;
    font-weight: bold;
    width: 16px;
}

/* Ajustes finais para garantir compatibilidade */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .btn-group {
        justify-content: center;
    }
}

/* Correção para modal de imagem em tela cheia */
#fullImageModal {
    z-index: 9999 !important;
    background-color: rgba(0, 0, 0, 0.95) !important;
}

#imageViewModal {
    z-index: 1000;
}

#imageManagementModal {
    z-index: 1000;
}

/* Controlar tamanho da imagem em tela cheia */
#fullImageDisplay {
    max-width: 90vw !important;
    max-height: 90vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Container da imagem */
#fullImageModal .max-w-full {
    max-width: 95vw !important;
    max-height: 95vh !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Para imagens muito grandes */
@media (max-width: 768px) {
    #fullImageDisplay {
        max-width: 95vw !important;
        max-height: 80vh !important;
    }
}

/* Botões de navegação */
#prevImageBtn, #nextImageBtn {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

#prevImageBtn:hover, #nextImageBtn:hover {
  transform: translateY(-50%) scale(1.1);
  background-color: rgba(0, 0, 0, 0.8) !important;
}

#prevImageBtn:disabled, #nextImageBtn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Contador de imagens */
#imageCounter {
  backdrop-filter: blur(8px);
}

/* Responsivo */
@media (max-width: 768px) {
  #prevImageBtn, #nextImageBtn {
    width: 50px;
    height: 50px;
  }
  
  #prevImageBtn {
    left: 8px;
  }
  
  #nextImageBtn {
    right: 8px;
  }
}