/* Estilos personalizados adicionais */
:root {
    --primary-color: #3b82f6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
}

/* Animações */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.success-pulse {
    animation: successPulse 2s ease-in-out;
}

@keyframes successPulse {

    0%,
    100% {
        background-color: #f0f9ff;
    }

    50% {
        background-color: #dcfce7;
    }
}

/* Tabela responsiva */
#products-list>tr>td {
    padding: 12px 16px;
    vertical-align: middle;
}

/* Responsividade da tabela */
@media (max-width: 640px) {

    #products-list>tr>td:nth-child(2),
    #products-list>tr>td:nth-child(5) {
        display: none;
    }

    #products-list>tr>td {
        padding: 10px 12px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    #products-list>tr>td:nth-child(5) {
        display: none;
    }
}

/* Scanner */
.barcode-scanner-container {
    width: 100%;
    max-width: 500px;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    margin: 0 auto;
}

.scanner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.scanner-content {
    width: 95%;
    max-width: 500px;
    text-align: center;
    color: white;
    padding: 20px;
}

.scanner-frame {
    width: 100%;
    height: 300px;
    border: 3px solid var(--primary-color);
    border-radius: 12px;
    overflow: hidden;
    margin: 20px 0;
    position: relative;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
}

.scanner-frame::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 280px;
    height: 2px;
    background: linear-gradient(90deg,
            transparent 0%,
            var(--primary-color) 50%,
            transparent 100%);
    animation: scanLine 2s ease-in-out infinite;
    transform: translateX(-50%);
}

@keyframes scanLine {

    0%,
    100% {
        top: 20%;
    }

    50% {
        top: 80%;
    }
}

.scanner-guide {
    position: absolute;
    top: 20%;
    left: 10%;
    right: 10%;
    bottom: 20%;
    border: 2px dashed rgba(59, 130, 246, 0.5);
    border-radius: 8px;
    pointer-events: none;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    padding: 16px;
    backdrop-filter: blur(3px);
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: calc(100vw - 40px);
}

.toast {
    min-width: 260px;
    max-width: 360px;
    padding: 16px 20px;
    border-radius: 10px;
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

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

.toast.error {
    background-color: var(--danger-color);
}

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

.toast.info {
    background-color: var(--primary-color);
}

.toast-icon {
    font-size: 18px;
    margin-top: 1px;
}

/* Responsividade geral */
@media (max-width: 640px) {
    .modal-content {
        padding: 20px;
        margin: 16px;
    }

    .scanner-frame {
        height: 250px;
    }

    .toast {
        min-width: auto;
        width: calc(100vw - 40px);
    }
}

@media (max-width: 480px) {
    #initial-screen .max-w-md {
        margin: 8px;
    }

    .modal-content {
        padding: 16px;
        margin: 8px;
    }

    .scanner-content {
        padding: 16px;
    }
}

/* Melhorias de acessibilidade */
@media (prefers-reduced-motion: reduce) {

    .fade-in,
    .slide-up,
    .toast,
    .scanner-frame::before {
        animation: none !important;
        transition: none !important;
    }
}

/* Estilos para impressão */
@media print {

    .modal-overlay,
    .scanner-overlay,
    #scan-product-btn,
    #manual-add-btn,
    #export-btn,
    #clear-all-btn,
    #share-btn,
    #finish-btn,
    .toast-container,
    footer {
        display: none !important;
    }

    body {
        background: white !important;
    }

    #main-screen {
        display: block !important;
        padding: 0 !important;
    }

    #products-table {
        display: block !important;
    }

    .bg-white {
        background: white !important;
        box-shadow: none !important;
    }
}

/* Estilos para o sistema de exportação */
.export-format-option input:checked+div {
    border-color: #3b82f6;
    background-color: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.export-format-option:hover div {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.export-format-option div {
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Botões de compartilhamento */
.share-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    border-radius: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
    cursor: pointer;
}

.share-option:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
}

.share-option.whatsapp {
    color: #25D366;
}

.share-option.email {
    color: #EA4335;
}

.share-option.telegram {
    color: #0088cc;
}

.share-option.copy {
    color: #6b7280;
}

/* Indicador de sucesso */
.copy-success::after {
    content: "✓ Copiado!";
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
}

/* Animação de loading para exportação */
.export-loading {
    position: relative;
    color: transparent !important;
}

.export-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Preview de exportação */
#export-preview {
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Estilos para tabela de preview em PDF */
.pdf-preview table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.pdf-preview th {
    background-color: #f3f4f6;
    font-weight: 600;
    text-align: left;
    padding: 8px;
    border: 1px solid #e5e7eb;
}

.pdf-preview td {
    padding: 8px;
    border: 1px solid #e5e7eb;
}

.pdf-preview .total-row {
    background-color: #eff6ff;
    font-weight: bold;
}