/* Estilos customizados para o Freezer System */

/* Layout geral */
.content-wrapper {
    min-height: calc(100vh - 57px);
}

/* Cards */
.card {
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.2);
    border: 0;
}

.card-header {
    border-bottom: 1px solid rgba(0,0,0,.125);
    background-color: transparent;
}

/* Botões */
.btn {
    border-radius: 3px;
}

.btn-sm {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
}

/* Tabelas */
.table {
    margin-bottom: 0;
}

.table thead th {
    border-top: 0;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

.table-responsive {
    border: 0;
}

/* Status badges */
.badge {
    font-size: 0.75em;
}

.badge-success {
    background-color: #28a745;
}

.badge-danger {
    background-color: #dc3545;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-info {
    background-color: #17a2b8;
}

/* Formulários */
.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.invalid-feedback {
    display: block;
}

/* Loading spinner */
.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.spinner-border {
    width: 2rem;
    height: 2rem;
}

/* Device status indicators */
.device-status {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.device-status.online {
    background-color: #28a745;
}

.device-status.offline {
    background-color: #dc3545;
}

.device-status.warning {
    background-color: #ffc107;
}

/* Temperature display */
.temp-display {
    font-size: 1.2em;
    font-weight: bold;
    color: #007bff;
}

.temp-high {
    color: #dc3545 !important;
}

.temp-low {
    color: #17a2b8 !important;
}

/* Charts container */
.chart-container {
    position: relative;
    height: 300px;
    margin: 15px 0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .content-wrapper {
        margin-left: 0;
    }
    
    .main-sidebar {
        margin-left: -250px;
    }
    
    .sidebar-open .main-sidebar {
        margin-left: 0;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn-group-vertical .btn {
        margin-bottom: 5px;
    }
}

/* Toast notifications */
.toast {
    opacity: 1;
}

/* Login page styles */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    width: 360px;
    margin: 7% auto;
}

.login-card-body {
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    padding: 30px;
}

.login-logo a {
    color: #fff;
    font-size: 2.1rem;
    font-weight: 300;
    text-decoration: none;
}

/* Dashboard widgets */
.info-box {
    display: block;
    min-height: 90px;
    background: #fff;
    width: 100%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    border-radius: 2px;
    margin-bottom: 15px;
}

.info-box-icon {
    border-top-left-radius: 2px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 2px;
    display: block;
    float: left;
    height: 90px;
    width: 90px;
    text-align: center;
    font-size: 45px;
    line-height: 90px;
    background: rgba(0,0,0,0.2);
}

.info-box-content {
    padding: 5px 10px;
    margin-left: 90px;
}

.info-box-text {
    text-transform: uppercase;
    font-weight: bold;
    font-size: 13px;
}

.info-box-number {
    display: block;
    font-weight: bold;
    font-size: 18px;
}

/* ==== DEVICE MANAGEMENT STYLES ==== */

/* Device Test Interface */
.test-result {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.test-result.success {
    border-left: 5px solid #28a745;
    background: linear-gradient(135deg, #d4edda 0%, #f8f9fa 100%);
}

.test-result.error {
    border-left: 5px solid #dc3545;
    background: linear-gradient(135deg, #f8d7da 0%, #f8f9fa 100%);
}

.json-display {
    background: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    white-space: pre-wrap;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.preset-btn {
    margin: 3px;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.history-item {
    background: #fff;
    border: 1px solid #e3e6f0;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.history-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,123,255,0.15);
}

/* Device Form Styles */
.device-form .form-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.device-form .form-control {
    border-radius: 6px;
    border: 1.5px solid #e3e6f0;
    transition: all 0.2s ease;
}

.device-form .form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.15);
    transform: translateY(-1px);
}

.device-form .form-control.is-invalid {
    border-color: #dc3545;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Device Cards */
.device-card {
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.device-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.device-card .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 20px;
}

.device-card .card-body {
    padding: 25px;
}

/* Temperature Indicators */
.temp-normal { color: #28a745; }
.temp-high { 
    color: #dc3545; 
    animation: pulse-red 2s infinite;
}
.temp-low { 
    color: #17a2b8; 
    animation: pulse-blue 2s infinite;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes pulse-blue {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.temperature-card {
    min-width: 90px;
    border-radius: 8px;
    border: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.temperature-card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.temperature-card .card-body {
    padding: 15px 8px;
}

/* Digital I/O Badges */
.digital-badge {
    font-size: 0.8rem;
    padding: 6px 10px;
    border-radius: 20px;
    font-weight: 600;
    transition: all 0.2s ease;
    margin: 2px;
}

.digital-badge.on {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.3);
}

.digital-badge.off {
    background: #6c757d;
    color: white;
}

.digital-badge:hover {
    transform: scale(1.1);
}

/* Device Status Indicators */
.device-status-indicator {
    position: relative;
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 10px;
}

.device-status-indicator.online {
    background: #28a745;
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3);
    animation: pulse-online 2s infinite;
}

.device-status-indicator.offline {
    background: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.3);
}

.device-status-indicator.warning {
    background: #ffc107;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.3);
}

@keyframes pulse-online {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* Device Actions */
.device-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.device-actions .btn {
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.device-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Confirmation Modal Styles */
.modal-danger .modal-content {
    border: 3px solid #dc3545;
    border-radius: 12px;
}

.modal-danger .modal-header {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border-radius: 8px 8px 0 0;
}

.confirm-input {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    border: 2px solid #dc3545;
    border-radius: 8px;
}

.confirm-input:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Statistics and Metrics */
.metric {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    background: #f8f9fa;
    margin-bottom: 15px;
    transition: all 0.2s ease;
}

.metric:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.metric h4 {
    margin-bottom: 5px;
    font-weight: bold;
    color: #495057;
}

.metric small {
    color: #6c757d;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Filter Controls */
.filter-controls {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.filter-controls .form-control,
.filter-controls .form-control-sm {
    border-radius: 6px;
    border: 1px solid #ced4da;
}

.filter-stats {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
    margin-top: 10px;
}

/* Data Table Enhancements */
.data-table {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.data-table thead th {
    background: linear-gradient(135deg, #495057, #6c757d);
    color: white;
    font-weight: 600;
    border: none;
    padding: 15px 12px;
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
    transform: scale(1.01);
}

.data-table tbody td {
    padding: 12px;
    vertical-align: middle;
    border-color: #e9ecef;
}

/* Pagination Improvements */
.pagination .page-link {
    border-radius: 6px;
    margin: 0 2px;
    border: 1px solid #dee2e6;
    color: #495057;
    transition: all 0.2s ease;
}

.pagination .page-link:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
    transform: translateY(-1px);
}

.pagination .page-item.active .page-link {
    background: #007bff;
    border-color: #007bff;
}

/* Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .device-card {
        margin-bottom: 20px;
    }
    
    .temperature-card {
        min-width: 70px;
        margin-bottom: 10px;
    }
    
    .device-actions {
        flex-direction: column;
        gap: 5px;
    }
    
    .device-actions .btn {
        width: 100%;
        font-size: 0.8rem;
    }
    
    .filter-controls {
        padding: 15px;
    }
    
    .filter-controls .form-inline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-controls .form-group {
        margin-bottom: 10px;
        margin-right: 0 !important;
    }
    
    .data-table {
        font-size: 0.85rem;
    }
    
    .data-table thead th,
    .data-table tbody td {
        padding: 8px 6px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .device-card {
        background: #343a40;
        color: #f8f9fa;
    }
    
    .filter-controls {
        background: #343a40;
        border-color: #495057;
        color: #f8f9fa;
    }
    
    .data-table tbody tr:hover {
        background: #495057;
    }
    
    .metric {
        background: #343a40;
        color: #f8f9fa;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Success/Error States */
.success-state {
    border: 2px solid #28a745;
    background: linear-gradient(135deg, #d4edda, #f8f9fa);
}

.error-state {
    border: 2px solid #dc3545;
    background: linear-gradient(135deg, #f8d7da, #f8f9fa);
}

/* Utility Classes */
.text-shadow {
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.box-shadow-sm {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.box-shadow-md {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.box-shadow-lg {
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

/* ==== MQTT CONTROL STYLES ==== */

/* Botões de Controle Digital Output */
.control-output-btn {
    height: 80px;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.control-output-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.control-output-btn:active {
    transform: translateY(0);
}

.control-output-btn i {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.control-output-btn small {
    font-size: 0.7rem;
    opacity: 0.8;
}

.control-output-btn strong {
    font-size: 0.8rem;
    font-weight: bold;
}

/* Estados dos botões */
.control-output-btn.btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    border-color: #28a745;
    animation: pulse-success 2s infinite;
}

.control-output-btn.btn-outline-secondary {
    border-color: #6c757d;
    color: #6c757d;
}

.control-output-btn.btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

@keyframes pulse-success {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* Status MQTT */
#mqtt-status {
    padding: 5px 10px;
    border-radius: 15px;
    background: rgba(0,0,0,0.05);
    display: inline-block;
    font-weight: 500;
}

#mqtt-status .fa-circle {
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* Botões de conexão MQTT */
.btn-xs {
    padding: 2px 8px;
    font-size: 0.75rem;
    border-radius: 3px;
}

/* Notificações Toast */
.alert.position-fixed {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Seção de controle */
.control-section {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    border: 1px solid #dee2e6;
}

.control-section h6 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 15px;
}

/* Indicadores de status melhorados */
.mqtt-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.mqtt-indicator.connected {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border: 1px solid #c3e6cb;
}

.mqtt-indicator.disconnected {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.mqtt-indicator.connecting {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Responsividade para controles MQTT */
@media (max-width: 768px) {
    .control-output-btn {
        height: 60px;
        margin-bottom: 10px;
    }
    
    .control-output-btn i {
        font-size: 1rem;
    }
    
    .control-output-btn small {
        font-size: 0.6rem;
    }
    
    .control-output-btn strong {
        font-size: 0.7rem;
    }
    
    .btn-xs {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
}

