/* ===================================
   CALCULADORA DE pH e pOH - CSS ISOLADO
   =================================== */

/* ===== SEÇÃO DA CALCULADORA ===== */
.ph-calculator-section {
    margin-bottom: 3rem;
}

.ph-calculator-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: none;
}

/* ===== HEADER DA CALCULADORA ===== */
.ph-header {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
}

.ph-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="chemical" width="50" height="50" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="40" cy="40" r="1.5" fill="rgba(255,255,255,0.08)"/><circle cx="25" cy="35" r="1" fill="rgba(255,255,255,0.12)"/></pattern></defs><rect width="100" height="100" fill="url(%23chemical)"/></svg>') repeat;
    opacity: 0.3;
}

.ph-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.ph-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== WRAPPER DA CALCULADORA ===== */
.ph-calculator-wrapper {
    padding: 2rem;
    width: 100%;
    box-sizing: border-box;
}

/* ===== COMPATIBILIDADE COM GRID LAYOUT ===== */
/* Garante que o conteúdo se adapte ao grid sem criar barras horizontais */
.content {
    min-width: 0; /* Previne overflow no grid */
    overflow-x: hidden; /* Previne scroll horizontal */
}

.ph-calculator-section,
.ph-educational-content {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

/* Adapta suavemente quando sidebar colapsa/expande */
.main-container.sidebar-collapsed .ph-calculator-wrapper {
    /* Aproveita o espaço extra quando sidebar colapsa (de 250px para 60px) */
    transition: all 0.4s ease;
}

.main-container .ph-calculator-wrapper {
    /* Transição suave quando sidebar expande */
    transition: all 0.4s ease;
}

/* ===== ESCALA DE pH VISUAL ===== */
.ph-scale-container {
    margin-bottom: 3rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    padding: 2rem;
    border: 1px solid #dee2e6;
    width: 100%;
    box-sizing: border-box;
}

.ph-scale-container h3 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 2rem;
    font-size: 1.4rem;
    font-weight: 600;
}

.ph-scale {
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    width: 100%;
}

.ph-scale-bar {
    height: 60px;
    border-radius: 30px;
    position: relative;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.ph-scale-gradient {
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to right,
        #ff0000 0%,    /* pH 0 - Vermelho forte */
        #ff4500 7.14%, /* pH 1 */
        #ff8c00 14.28%, /* pH 2 */
        #ffa500 21.42%, /* pH 3 */
        #ffff00 28.56%, /* pH 4 */
        #adff2f 35.7%, /* pH 5 */
        #90ee90 42.84%, /* pH 6 */
        #00ff00 50%,   /* pH 7 - Verde (neutro) */
        #00ffff 57.14%, /* pH 8 */
        #0080ff 64.28%, /* pH 9 */
        #0040ff 71.42%, /* pH 10 */
        #0000ff 78.56%, /* pH 11 */
        #4000ff 85.7%, /* pH 12 */
        #8000ff 92.84%, /* pH 13 */
        #c000ff 100%   /* pH 14 - Roxo */
    );
}

.ph-scale-marker {
    position: absolute;
    top: -10px;
    transform: translateX(-50%);
    z-index: 10;
}

.ph-marker-value {
    background: #2c3e50;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.1rem;
    text-align: center;
    min-width: 60px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.ph-marker-arrow {
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #2c3e50;
    margin: 0 auto;
}

.ph-scale-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    padding: 0 15px;
}

.ph-label {
    font-weight: bold;
    color: #495057;
    font-size: 0.9rem;
    text-align: center;
    min-width: 20px;
}

.ph-scale-regions {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    font-weight: bold;
    font-size: 0.9rem;
}

.ph-region {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    border-radius: 8px;
    margin: 0 0.2rem;
}

.ph-region.acidic {
    background: rgba(255, 0, 0, 0.1);
    color: #dc3545;
    border: 1px solid rgba(255, 0, 0, 0.3);
}

.ph-region.neutral {
    background: rgba(0, 255, 0, 0.1);
    color: #28a745;
    border: 1px solid rgba(0, 255, 0, 0.3);
}

.ph-region.basic {
    background: rgba(0, 0, 255, 0.1);
    color: #007bff;
    border: 1px solid rgba(0, 0, 255, 0.3);
}

/* ===== SELETOR DE TIPO ===== */
.ph-type-selector {
    margin-bottom: 2rem;
    text-align: center;
    width: 100%;
}

.ph-type-selector h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    font-weight: 600;
}

.ph-type-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.ph-type-btn {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ph-type-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.15);
    border-color: #dc3545;
    background: linear-gradient(145deg, #fff5f5 0%, #ffe6e6 100%);
}

.ph-type-btn.active {
    background: linear-gradient(145deg, #dc3545 0%, #c82333 100%);
    color: white;
    border-color: #c82333;
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.ph-type-btn.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.5);
}

/* ===== CONTAINERS DE FORMULÁRIO ===== */
.ph-form-container {
    background: #ffffff;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.ph-form-container:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.ph-form-container.hidden {
    display: none;
}

/* ===== DISPLAY DE FÓRMULAS ===== */
.ph-formula-display {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe6e6 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-left: 5px solid #dc3545;
    width: 100%;
    box-sizing: border-box;
}

.ph-formula-display h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.ph-formula-display .formula {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: bold;
    color: #dc3545;
    text-align: center;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 2px solid #ffe6e6;
}

.ph-formula-display p {
    color: #6c757d;
    font-size: 0.9rem;
    text-align: center;
    margin: 0;
}

/* ===== GRID DE INPUTS ===== */
.ph-input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

.ph-input-group {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Previne overflow */
}

.ph-input-group label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ph-input-group input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    background: #ffffff;
    transition: all 0.3s ease;
    box-sizing: border-box;
    min-width: 0; /* Previne overflow */
}

.ph-input-group input:focus {
    outline: none;
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
    background: #fff5f5;
}

.ph-input-group input:invalid {
    border-color: #dc3545;
}

.ph-input-group input::placeholder {
    color: #adb5bd;
    font-style: italic;
}

.input-help {
    color: #6c757d;
    font-size: 0.8rem;
    margin-top: 0.3rem;
    font-style: italic;
}

/* ===== BOTÃO CALCULAR ===== */
.ph-calculate-btn {
    width: 100%;
    background: linear-gradient(145deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1.2rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.ph-calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(40, 167, 69, 0.4);
    background: linear-gradient(145deg, #218838 0%, #1e7e34 100%);
}

.ph-calculate-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.ph-calculate-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== RESULTADO ===== */
.ph-result {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    border-left: 5px solid #28a745;
    animation: slideInUp 0.5s ease-out;
}

.ph-result h3 {
    color: #155724;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    font-weight: 600;
}

.ph-result-content {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid #b8daff;
}

.ph-result-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #dc3545;
    text-align: center;
    margin-bottom: 1rem;
    font-family: 'Courier New', monospace;
}

.ph-result-details {
    color: #495057;
    line-height: 1.6;
}

.ph-result-classification {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    border-left: 4px solid #17a2b8;
}

.ph-result-complete {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.ph-complete-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    border: 1px solid #dee2e6;
}

.ph-complete-label {
    font-weight: bold;
    color: #495057;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.ph-complete-value {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    color: #dc3545;
}

/* ===== AVISO LEGAL ===== */
.ph-legal-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    text-align: center;
}

.ph-legal-notice p {
    margin: 0;
    color: #856404;
    font-size: 0.9rem;
}

/* ===== EXPLICAÇÃO DO CÁLCULO ===== */
.ph-explanation {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    border-left: 5px solid #17a2b8;
    animation: slideInUp 0.5s ease-out 0.2s both;
}

.ph-explanation h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    font-weight: 600;
}

.ph-step {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid #17a2b8;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.ph-step h4 {
    color: #17a2b8;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.ph-step .formula-calculation {
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    margin: 0.5rem 0;
    font-size: 1.1rem;
    color: #495057;
}

/* ===== EXEMPLOS RÁPIDOS ===== */
.ph-examples {
    text-align: center;
    margin-bottom: 2rem;
}

.ph-examples p {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.ph-example-btn {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #dee2e6;
    border-radius: 25px;
    padding: 0.7rem 1.5rem;
    margin: 0.3rem;
    font-size: 0.9rem;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.ph-example-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-color: #dc3545;
    background: linear-gradient(145deg, #fff5f5 0%, #ffe6e6 100%);
}

.ph-example-btn:active {
    transform: translateY(0);
}

/* ===== HELP SECTION ===== */
.ph-help {
    background: #ffe6e6;
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    border: 1px solid #ffcccc;
}

.ph-help p {
    margin: 0;
    color: #c82333;
    font-size: 0.9rem;
}

/* ===== CONTEÚDO EDUCACIONAL ===== */
.ph-educational-content {
    margin-top: 2rem;
}

.ph-content-block {
    background: white;
    border-radius: 15px;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #f1f3f4;
}

.ph-content-block h2 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    border-bottom: 3px solid #dc3545;
    padding-bottom: 0.5rem;
    display: inline-block;
}

.ph-content-block p {
    color: #495057;
    line-height: 1.8;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* ===== GRIDS EDUCACIONAIS ===== */
.ph-scale-info-grid,
.ph-cotidiano-grid,
.ph-aplicacoes-grid,
.ph-medicao-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
    width: 100%;
}

.ph-scale-info-item,
.ph-cotidiano-item,
.ph-aplicacao-item,
.ph-medicao-item {
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    border: 1px solid #e3f2fd;
    transition: all 0.3s ease;
    min-width: 0; /* Previne overflow */
    box-sizing: border-box;
}

.ph-scale-info-item.acidic-info {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe6e6 100%);
}

.ph-scale-info-item.neutral-info {
    background: linear-gradient(135deg, #f0fff0 0%, #e6ffe6 100%);
}

.ph-scale-info-item.basic-info {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
}

.ph-cotidiano-item,
.ph-aplicacao-item,
.ph-medicao-item {
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
}

.ph-scale-info-item:hover,
.ph-cotidiano-item:hover,
.ph-aplicacao-item:hover,
.ph-medicao-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(220, 53, 69, 0.15);
    border-color: #dc3545;
}

.ph-scale-info-icon,
.ph-cotidiano-icon,
.ph-aplicacao-icon,
.ph-medicao-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.ph-scale-info-item h4,
.ph-cotidiano-item h4,
.ph-aplicacao-item h4,
.ph-medicao-item h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    font-weight: 600;
}

.ph-scale-info-item p,
.ph-cotidiano-item p,
.ph-aplicacao-item p,
.ph-medicao-item p {
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.ph-cotidiano-item ul,
.ph-aplicacao-item ul {
    list-style: none;
    padding: 0;
    text-align: left;
}

.ph-cotidiano-item li,
.ph-aplicacao-item li {
    color: #495057;
    margin-bottom: 0.3rem;
    padding-left: 1rem;
    position: relative;
}

.ph-cotidiano-item li::before,
.ph-aplicacao-item li::before {
    content: '•';
    color: #dc3545;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* ===== NOTA IMPORTANTE ===== */
.ph-important-note {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-radius: 10px;
    padding: 2rem;
    margin: 2rem 0;
    border-left: 5px solid #ffc107;
}

.ph-important-note h4 {
    color: #856404;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.ph-important-note ul {
    list-style: none;
    padding: 0;
}

.ph-important-note li {
    color: #856404;
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.ph-important-note li::before {
    content: '⚠️';
    position: absolute;
    left: 0;
}

/* ===== REFERÊNCIAS ===== */
.referencias-container {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 2rem;
    border: 1px solid #dee2e6;
}

.referencias-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.referencias-list li {
    color: #495057;
    margin-bottom: 1rem;
    padding-left: 2rem;
    position: relative;
    line-height: 1.6;
}

.referencias-list li::before {
    content: '📚';
    position: absolute;
    left: 0;
    top: 0;
}

/* ===== ANIMAÇÕES ===== */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes phMarkerMove {
    0% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.1);
    }
    100% {
        transform: translateX(-50%) scale(1);
    }
}

.ph-scale-marker.animate {
    animation: phMarkerMove 0.5s ease-out;
}

/* ===== RESPONSIVIDADE ESPECÍFICA DA CALCULADORA ===== */

/* Desktop: Otimização para sidebar colapsado */
@media (min-width: 769px) {
    .main-container.sidebar-collapsed .ph-type-buttons {
        /* Mais espaço = mais colunas quando sidebar colapsa */
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
    
    .main-container.sidebar-collapsed .ph-input-grid {
        /* Melhor distribuição dos inputs quando há mais espaço */
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

/* Tablet - Adapta ao grid 220px 1fr 280px */
@media (max-width: 1024px) {
    .ph-calculator-wrapper {
        padding: 1.5rem;
    }
    
    .ph-scale-container {
        padding: 1.5rem;
    }
    
    .ph-type-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }
    
    .ph-content-block {
        padding: 2rem 1.5rem;
    }
    
    .ph-input-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

/* Mobile - Layout single column */
@media (max-width: 768px) {
    .ph-calculator-wrapper {
        padding: 1rem;
    }
    
    .ph-scale-container {
        padding: 1rem;
    }
    
    .ph-scale-bar {
        height: 50px;
    }
    
    .ph-scale-labels {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .ph-type-buttons {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .ph-type-btn {
        padding: 1rem;
        font-size: 0.9rem;
        min-height: 50px;
    }
    
    .ph-form-container {
        padding: 1.5rem;
    }
    
    .ph-input-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .ph-content-block {
        padding: 2rem 1rem;
        margin-bottom: 1.5rem;
    }
    
    .ph-content-block h2 {
        font-size: 1.6rem;
    }
    
    .ph-scale-info-grid,
    .ph-cotidiano-grid,
    .ph-aplicacoes-grid,
    .ph-medicao-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .ph-example-btn {
        display: block;
        width: 100%;
        margin: 0.5rem 0;
        padding: 1rem;
    }
    
    .ph-result-complete {
        grid-template-columns: 1fr;
    }
    
    /* Garante que em mobile o conteúdo não cause overflow */
    .ph-calculator-section,
    .ph-educational-content {
        overflow-x: hidden;
    }
    
    .ph-scale-labels {
        font-size: 0.8rem;
    }
    
    .ph-scale-regions {
        font-size: 0.8rem;
    }
}