/* Variáveis do Sistema */
:root {
    --primary: #2563eb;
    --primary-glow: rgba(37, 99, 235, 0.4);
    --secondary: #64748b;
    --accent-orange: #f59e0b;
    --accent-blue: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border-color: rgba(51, 65, 85, 0.5);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    
    --radius-lg: 16px;
    --radius-md: 8px;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    margin: 0;
}

/* Header Navbar Override */
.header {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    padding: 0 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-size: 1.5rem;
    color: var(--text-main);
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.btn {
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
    font-family: 'Inter', sans-serif;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #1d4ed8; box-shadow: 0 0 15px var(--primary-glow); }
.btn-secondary { background: var(--border-color); color: var(--text-main); }
.btn-secondary:hover { background: #475569; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

/* Dashboard Layout */
.dashboard-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Status Banner */
.status-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    font-weight: 500;
}

.pulse-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.pulse-indicator.disconnected {
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}
.pulse-indicator.connected {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.section-heading {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 8px;
    display: inline-flex;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h3 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.value-highlight {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: 'Outfit';
    color: var(--text-main);
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1rem;
}

/* Progress Bars */
.progress-bar-container {
    width: 100%;
    height: 24px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
}

.progress-bar {
    height: 100%;
    border-radius: 12px;
    transition: width 0.5s ease-in-out;
}

.food-bar {
    background: linear-gradient(90deg, #d97706, #fbbf24);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.water-bar {
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* Pet Monitor Card */
.pet-monitor-card {
    text-align: center;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.monitor-state.hidden { display: none; }

.large-icon {
    font-size: 4rem;
    color: var(--border-color);
    margin-bottom: 1rem;
}

.pet-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 1rem;
    box-shadow: 0 0 20px var(--primary-glow);
    border: 3px solid white;
}

.glow-text {
    color: var(--success);
    text-shadow: 0 0 8px rgba(16,185,129, 0.5);
    margin-bottom: 0.5rem;
}

.live-stats {
    margin-top: 1rem;
    display: flex;
    gap: 10px;
    justify-content: center;
    font-size: 0.85rem;
}

.pulse-badge {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #ef4444;
    animation: blink 1.5s infinite;
}

@keyframes blink { 0%, 100% {opacity: 1;} 50% {opacity: 0.4;} }

/* Terminal */
.terminal-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 300px;
}
.terminal-header {
    background: rgba(0,0,0,0.5);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}
.terminal-body {
    flex-grow: 1;
    padding: 10px 15px;
    font-family: 'Consolas', monospace;
    font-size: 0.8rem;
    color: #4ade80;
    overflow-y: auto;
    background: #000;
}
.terminal-input-group {
    display: flex;
    border-top: 1px solid var(--border-color);
}
.terminal-input-group input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 10px 15px;
    font-family: 'Consolas', monospace;
}
.terminal-input-group input:focus { outline: none; }
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
}
.btn-icon:hover { color: white; }
.terminal-input-group button {
    background: var(--primary);
    border: none;
    color: white;
    padding: 0 15px;
    cursor: pointer;
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
}
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
}
.empty-state i { font-size: 2rem; margin-bottom: 10px; opacity: 0.5; }

.history-item {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.hist-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
.hist-details { flex-grow: 1; }
.hist-details strong { display: block; font-family: 'Outfit'; font-size: 1.1rem; }
.hist-time { font-size: 0.75rem; color: var(--text-muted); }
.hist-consumption {
    text-align: right;
    font-size: 0.85rem;
}
.consumo-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-bottom: 4px;
}
.consumo-tag.food { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.consumo-tag.water { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}
.modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: 0.3s;
}
.modal-overlay.active .modal-content { transform: translateY(0); }

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-body { padding: 1.5rem; }
.input-group { margin-bottom: 1rem; }
.input-group input, .input-group select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    color: white;
    border-radius: var(--radius-md);
    font-family: inherit;
    box-sizing: border-box;
}

.pet-list { margin: 1.5rem 0; border-top: 1px solid var(--border-color); padding-top: 1rem; }
.pet-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}
