:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    
    --chart-temp: #ef4444; /* Vermelho para temperatura */
    --chart-ur: #3b82f6; /* Azul para umidade */
    
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.header {
    margin-bottom: 2rem;
    text-align: center;
}

.header h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #818cf8, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.version-badge {
    -webkit-text-fill-color: #38bdf8; /* Brighter blue for contrast */
    background: rgba(56, 189, 248, 0.15); /* Tinted background */
    font-size: 0.875rem;
    font-weight: 600; /* Bolder text */
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid rgba(56, 189, 248, 0.3); /* Tinted border */
}

.header p {
    color: var(--text-muted);
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 250px;
}

.hidden-input {
    display: none;
}

.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.file-label:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.file-name {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.limits-config {
    flex: 2;
    min-width: 350px;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    padding: 0 2rem;
}

.limits-config h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.limits-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.limit-input {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.limit-input label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.limit-input input,
.limit-input select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    outline: none;
    transition: var(--transition);
}

.limit-input select option {
    background: var(--bg-color);
    color: var(--text-main);
}

.limit-input input:focus,
.limit-input select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    min-width: 200px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.primary {
    background-color: var(--primary);
    color: white;
}

.btn.primary:not(:disabled):hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn.secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn.secondary:not(:disabled):hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.btn.icon-btn {
    padding: 0.5rem;
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
}

.btn.icon-btn:hover {
    color: var(--text-main);
    border-color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.05);
}

.chart-card .btn.icon-btn {
    color: #64748b;
    border-color: #cbd5e1;
}

.chart-card .btn.icon-btn:hover {
    color: #0f172a;
    border-color: #94a3b8;
    background-color: #f1f5f9;
}

.charts-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
    color: var(--text-muted);
    background: rgba(30, 41, 59, 0.3);
    border: 1px dashed var(--border-color);
    border-radius: 1rem;
    gap: 1rem;
}

.chart-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: #ffffff;
    border-color: #e2e8f0;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.device-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    background: transparent;
    border: 1px solid transparent;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    transition: var(--transition);
}

.device-title[contenteditable="true"]:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    cursor: text;
}

.device-title[contenteditable="true"]:focus {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
    outline: none;
}

.edit-icon {
    color: var(--text-muted);
    opacity: 0.7;
    transition: var(--transition);
}

.title-wrapper:hover .edit-icon {
    opacity: 1;
    color: var(--primary);
}

.chart-actions {
    display: flex;
    gap: 0.5rem;
}

.chart-body {
    position: relative;
    height: 600px;
    width: 100%;
}

/* Responsividade */
@media (max-width: 1024px) {
    .limits-config {
        border: none;
        padding: 0;
        border-top: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);
        padding-top: 1rem;
        padding-bottom: 1rem;
        flex-basis: 100%;
        order: 3;
    }
}

@media (max-width: 768px) {
    .limits-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .actions {
        flex-basis: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .actions .btn {
        flex: 1;
        min-width: 150px;
    }
}

/* Print e Exportação (PDF) styles */
.pdf-export-mode .app-container {
    padding: 0;
    max-width: none;
}

.pdf-export-mode .chart-card {
    page-break-inside: avoid;
    page-break-after: always;
    border: none;
    box-shadow: none;
    border-radius: 0;
    margin-bottom: 0;
    background: white; /* Fundo branco pra impressão */
    color: black; /* Texto preto pra impressão */
}

.pdf-export-mode .device-title {
    color: black;
}

.pdf-export-mode .chart-header {
    border-bottom-color: #e2e8f0;
}
