/**
 * Controle de Cilindros CO2 - Frontend/Mobile CSS
 * Version: 1.0.0
 */

/* ==========================================================================
   CONTAINER PRINCIPAL
   ========================================================================== */
.cco2-leitor-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.cco2-leitor-header {
    text-align: center;
    margin-bottom: 20px;
}

.cco2-leitor-header h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 20px;
    color: #1d2327;
    margin: 0;
}

/* ==========================================================================
   TELA DE PIN
   ========================================================================== */
.cco2-tela-pin {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.cco2-pin-box {
    background: #fff;
    padding: 40px 30px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    text-align: center;
    width: 100%;
    max-width: 320px;
}

.cco2-pin-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.cco2-pin-box h3 {
    margin: 0 0 10px;
    font-size: 22px;
    color: #1d2327;
}

.cco2-pin-box p {
    color: #646970;
    margin: 0 0 25px;
}

.cco2-pin-box input {
    width: 100%;
    padding: 18px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 24px;
    text-align: center;
    letter-spacing: 8px;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.cco2-pin-box input:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.2);
}

.cco2-pin-erro {
    color: #e03131;
    font-weight: 600;
    margin-top: 15px;
}

/* ==========================================================================
   TABS
   ========================================================================== */
.cco2-leitor-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    background: #f0f0f0;
    padding: 5px;
    border-radius: 12px;
}

.cco2-tab {
    flex: 1;
    padding: 12px 10px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #646970;
    cursor: pointer;
    transition: all 0.2s;
}

.cco2-tab.active {
    background: #fff;
    color: #1d2327;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ==========================================================================
   TAB CONTENT
   ========================================================================== */
.cco2-tab-content {
    display: none;
}

.cco2-tab-content.active {
    display: block;
}

/* QR Reader */
#qr-reader {
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

#qr-reader video {
    border-radius: 12px;
}

.cco2-instrucao {
    text-align: center;
    color: #646970;
    margin-top: 15px;
    font-size: 14px;
}

.cco2-erro-camera {
    text-align: center;
    padding: 40px 20px;
    color: #e03131;
    background: #ffe3e3;
    border-radius: 12px;
    line-height: 1.6;
}

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

.cco2-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1d2327;
    font-size: 14px;
}

.cco2-form-group input,
.cco2-form-group select,
.cco2-form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
}

.cco2-form-group input:focus,
.cco2-form-group select:focus,
.cco2-form-group textarea:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.2);
    outline: none;
}

.cco2-form-group input::placeholder {
    color: #a0a0a0;
}

/* ==========================================================================
   BOTÕES
   ========================================================================== */
.cco2-btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #2271b1 0%, #135e96 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cco2-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.4);
}

.cco2-btn-primary:active {
    transform: translateY(0);
}

.cco2-btn-success {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #2f9e44 0%, #1e7b32 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cco2-btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(47, 158, 68, 0.4);
}

/* ==========================================================================
   RESULTADO
   ========================================================================== */
.cco2-resultado {
    background: #fff;
    border-radius: 16px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.cco2-resultado h3 {
    font-size: 24px;
    margin: 0 0 5px;
    color: #1d2327;
}

.cco2-nome {
    color: #646970;
    margin: 0 0 20px;
}

.cco2-dados {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 20px 0;
}

.cco2-dado {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
}

.cco2-dado-label {
    display: block;
    font-size: 12px;
    color: #646970;
    margin-bottom: 5px;
}

.cco2-dado-valor {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #1d2327;
}

.cco2-dado-destaque {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.cco2-dado-destaque .cco2-dado-label {
    color: rgba(255,255,255,0.8);
}

.cco2-dado-destaque .cco2-dado-valor {
    color: #fff;
}

/* Status Badge */
.cco2-status-badge {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 10px;
}

.cco2-status-cheio { background: #d3f9d8; color: #2f9e44; }
.cco2-status-parcial { background: #fff3bf; color: #e67700; }
.cco2-status-em_uso { background: #e7f5ff; color: #1971c2; }
.cco2-status-vazio { background: #e9ecef; color: #495057; }
.cco2-status-manutencao { background: #ffe3e3; color: #c92a2a; }

/* Resultado Aprovado/Reprovado */
.cco2-resultado-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.cco2-resultado-msg {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
}

.cco2-resultado-detalhes {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.cco2-resultado-detalhes p {
    margin: 8px 0;
    color: #646970;
}

.cco2-aprovado {
    border: 3px solid #2f9e44;
    background: linear-gradient(180deg, #d3f9d8 0%, #fff 100%);
}

.cco2-aprovado .cco2-resultado-msg {
    color: #2f9e44;
}

.cco2-reprovado {
    border: 3px solid #e03131;
    background: linear-gradient(180deg, #ffe3e3 0%, #fff 100%);
}

.cco2-reprovado .cco2-resultado-msg {
    color: #e03131;
}

.cco2-info {
    border: 2px solid #2271b1;
}

.cco2-erro {
    background: #ffe3e3;
    border: 2px solid #e03131;
}

.cco2-erro .cco2-resultado-msg {
    color: #e03131;
}

/* ==========================================================================
   ÚLTIMA LOCAÇÃO
   ========================================================================== */
.cco2-ultima-locacao {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px dashed #e0e0e0;
    text-align: left;
}

.cco2-ultima-locacao h4 {
    margin: 0 0 15px;
    font-size: 16px;
    color: #1d2327;
    text-align: center;
}

.cco2-locacao-dados {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
}

.cco2-locacao-dados p {
    margin: 8px 0;
    font-size: 14px;
    color: #495057;
}

/* ==========================================================================
   HISTÓRICO
   ========================================================================== */
.cco2-historico {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.cco2-historico h4 {
    margin: 0 0 15px;
    font-size: 16px;
    color: #1d2327;
    text-align: center;
}

.cco2-historico-lista {
    max-height: 300px;
    overflow-y: auto;
}

.cco2-historico-item {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #e0e0e0;
    background: #f8f9fa;
}

.cco2-historico-item.cco2-op-saida_cliente {
    border-left-color: #e67700;
    background: #fff9e6;
}

.cco2-historico-item.cco2-op-retorno_cliente {
    border-left-color: #1971c2;
    background: #e7f5ff;
}

.cco2-historico-item.cco2-op-recarga_fornecedor {
    border-left-color: #2f9e44;
    background: #d3f9d8;
}

.cco2-historico-item.cco2-op-ajuste_manual {
    border-left-color: #7048e8;
    background: #f3f0ff;
}

.cco2-historico-item.cco2-op-cadastro {
    border-left-color: #868e96;
    background: #f1f3f5;
}

.cco2-historico-data {
    font-size: 12px;
    color: #868e96;
    margin-bottom: 5px;
}

.cco2-historico-op {
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
    margin-bottom: 5px;
}

.cco2-historico-detalhes {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: #495057;
}

.cco2-historico-detalhes span {
    background: rgba(255,255,255,0.7);
    padding: 3px 8px;
    border-radius: 5px;
}

/* ==========================================================================
   FORMULÁRIO DE REGISTRO
   ========================================================================== */
.cco2-form-registro {
    background: #fff;
    border-radius: 16px;
    padding: 25px;
    margin-top: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.cco2-form-registro h3 {
    margin: 0 0 20px;
    font-size: 18px;
    color: #1d2327;
    text-align: center;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 400px) {
    .cco2-leitor-tabs {
        flex-direction: column;
    }
    
    .cco2-dados {
        grid-template-columns: 1fr;
    }
    
    .cco2-historico-detalhes {
        flex-direction: column;
        gap: 5px;
    }
}

/* ==========================================================================
   DARK MODE (opcional)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    .cco2-leitor-container {
        /* Descomente para habilitar dark mode
        background: #1a1a2e;
        color: #eee;
        */
    }
}

/* ==========================================================================
   ANIMAÇÕES
   ========================================================================== */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.cco2-aprovado .cco2-resultado-icon {
    animation: pulse 1s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.cco2-reprovado .cco2-resultado-icon {
    animation: shake 0.5s ease-in-out;
}
