/* ========================================
   ESTILOS COMPLETOS DO FORMULÁRIO DE ENCOMENDA
   ======================================== */

.encomenda-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* LOADING */
.loading-container {
    text-align: center;
    padding: 100px 20px;
    color: var(--primary-color);
}

.loading-container i {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.loading-container p {
    font-size: 16px;
    color: #7f8c8d;
    margin-top: 20px;
}

/* CABEÇALHO */
.encomenda-header {
    background: white;
    padding: 20px 30px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.header-title h2 {
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2c3e50;
}

.header-title h2 i {
    color: var(--primary-color);
}

.info-criacao {
    font-size: 13px;
    color: #7f8c8d;
    margin: 8px 0;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
}

.info-criacao i {
    margin-right: 5px;
    color: var(--primary-color);
}

.info-contextual {
    font-size: 13px;
    color: #2c3e50;
    margin: 5px 0;
    padding: 6px 12px;
    background: #e8f5e9;
    border-left: 3px solid #4caf50;
    border-radius: 4px;
}

.info-contextual i {
    margin-right: 5px;
    color: #4caf50;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Botões pequenos */
.btn-primary-sm,
.btn-secondary-sm,
.btn-danger-sm,
.btn-warning-sm {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.btn-primary-sm {
    background: var(--primary-color);
    color: #000;
}

.btn-primary-sm:hover {
    background: #d49a0f;
}

.btn-secondary-sm {
    background: #6c757d;
    color: white;
}

.btn-secondary-sm:hover {
    background: #5a6268;
}

.btn-danger-sm {
    background: #dc3545;
    color: white;
}

.btn-danger-sm:hover {
    background: #c82333;
}

/* Botão Guardar com alterações pendentes - Destacar em vermelho */
.btn-danger {
    background: #dc3545 !important;
    color: white !important;
    font-weight: 700 !important;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.5) !important;
    animation: pulse-red 2s infinite;
}

.btn-danger:hover {
    background: #c82333 !important;
    box-shadow: 0 0 15px rgba(220, 53, 69, 0.7) !important;
    transform: translateY(-1px);
}

@keyframes pulse-red {
    0%, 100% {
        box-shadow: 0 0 10px rgba(220, 53, 69, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(220, 53, 69, 0.8);
    }
}

.btn-warning-sm {
    background: #ffc107;
    color: #000;
}

.btn-warning-sm:hover {
    background: #e0a800;
}

/* ALERTAS */
.encomenda-alertas {
    margin-bottom: 20px;
}

.alert {
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.alert i {
    font-size: 18px;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

/* AÇÕES RÁPIDAS */
.acoes-rapidas {
    background: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-acao {
    padding: 10px 18px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color) 0%, #d49a0f 100%);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-acao:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* CONTEÚDO - DUAS COLUNAS */
.encomenda-content {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    margin-bottom: 80px; /* Espaço para os botões fixos */
}

/* COLUNA OBSERVAÇÕES */
.coluna-observacoes {
    
}

.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h4 {
    margin: 0;
    font-size: 16px;
    color: #2c3e50;
}

.card-body {
    padding: 20px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(243, 180, 22, 0.1);
}

.form-control.has-history {
    border-color: var(--primary-color);
}

textarea.form-control {
    resize: vertical;
    min-height: 150px;
}

.obs-preview {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-left: 3px solid var(--primary-color);
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.6;
}

.obs-preview strong {
    color: #2c3e50;
}

.obs-preview .obs-text {
    display: block;
    margin: 8px 0;
    color: #555;
}

.obs-preview .obs-mais {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #dee2e6;
    text-align: center;
    color: #999;
    font-size: 11px;
}

/* COLUNA TABS */
.coluna-tabs {
    
}

/* Override de estilos do Angular Material */
md-tabs {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

md-tabs-wrapper {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

md-tab-item {
    color: #6c757d;
}

md-tab-item.md-active,
md-tab-item:focus {
    color: #000;
}

md-ink-bar {
    background: var(--primary-color) !important;
}

md-content.md-padding {
    padding: 25px;
}

/* FORM GRID */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-grid.docs-transporte {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group.checkbox-group {
    flex-direction: row;
    align-items: center;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 14px;
}

.form-group label small {
    font-weight: normal;
    color: #999;
    font-size: 12px;
}

.checkbox-label {
    margin-left: 8px;
    font-weight: normal;
}

.checkbox-label-importante {
    margin-left: 8px;
    font-weight: 600;
    color: #dc3545;
}

.input-with-button,
.input-with-buttons {
    display: flex;
    gap: 8px;
}

.input-with-button .form-control,
.input-with-buttons .form-control {
    flex: 1;
}

.btn-icon {
    padding: 10px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.btn-icon:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #000;
}

.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-link-sm {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.btn-link-sm:hover {
    color: #d49a0f;
}

.form-control-static {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    flex: 1;
    color: #555;
}

/* MORADA DISPLAY */
.morada-display {
    margin-top: -10px;
}

.morada-content {
    padding: 12px;
    background: #f8f9fa;
    border-left: 3px solid var(--primary-color);
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

/* PAGAMENTOS */
.pagamentos-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
}

.calculos-rapidos h5 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 15px;
}

.table-calculos {
    width: 100%;
    border-collapse: collapse;
}

.table-calculos tr {
    border-bottom: 1px solid #dee2e6;
}

.table-calculos tr.total-row {
    background: #f8f9fa;
    font-weight: 600;
}

.table-calculos td {
    padding: 10px 8px;
}

.table-calculos .text-right {
    text-align: right;
}

.btn-copiar {
    padding: 4px 10px;
    border: 1px solid var(--primary-color);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    color: var(--primary-color);
    transition: all 0.2s;
}

.btn-copiar:hover {
    background: var(--primary-color);
    color: #000;
}

.form-pagamento {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.confirmacao-info {
    margin-top: 8px;
    padding: 8px 12px;
    background: #d4edda;
    color: #155724;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.confirmacao-info i {
    color: #28a745;
}

/* OUTRAS FACTURAS */
.outras-facturas {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.outras-facturas h5 {
    margin: 0 0 10px 0;
    font-size: 15px;
    color: #2c3e50;
}

.lista-facturas {
    list-style: none;
    padding: 0;
    margin: 0;
}

.lista-facturas li {
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
    font-size: 14px;
    color: #555;
}

.lista-facturas li:last-child {
    border-bottom: none;
}

/* HISTÓRICO */
.historico-content {
    /* min-height: 200px; */
}

.table-historico {
    width: 100%;
    border-collapse: collapse;
}

.table-historico th {
    padding: 12px;
    background: #f8f9fa;
    font-weight: 600;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
    font-size: 14px;
    color: #2c3e50;
}

.table-historico td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    font-size: 13px;
    color: #555;
}

.table-historico td small {
    color: #999;
    font-size: 12px;
}

.table-historico tbody tr:hover {
    background: #f8f9fa;
}

.no-data {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.no-data i {
    margin-bottom: 15px;
    opacity: 0.5;
}

.no-data p {
    margin: 0;
    font-size: 14px;
}

/* BOTÕES DE AÇÃO DO FORMULÁRIO (FOOTER FIXO) */
.form-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 15px 30px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    z-index: 1000;
}

.btn-primary,
.btn-secondary {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: #000;
}

.btn-primary:hover:not(:disabled) {
    background: #d49a0f;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
    .encomenda-content {
        grid-template-columns: 1fr;
    }
    
    .pagamentos-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .encomenda-container {
        padding: 10px;
    }
    
    .encomenda-header {
        flex-direction: column;
        padding: 15px 20px;
    }
    
    .header-actions {
        width: 100%;
        margin-top: 15px;
    }
    
    .header-actions button {
        flex: 1;
    }
    
    .acoes-rapidas .btn-acao span {
        display: none;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        padding: 10px 15px;
    }
    
    .btn-primary,
    .btn-secondary {
        flex: 1;
        justify-content: center;
    }
}

