:root {
    --primary-blue: #2196F3;
    --success-green: #4CAF50;
    --warning-amber: #FFC107;
    --danger-red: #F44336;
    --accent-purple: #9C27B0;
    --background-light: #f5f5f5;
    --background-white: #ffffff;
    --text-dark: #333333;
    --text-light: #666666;
    --border-light: #e0e0e0;
    --shadow-light: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 8px rgba(0,0,0,0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-light);
    color: var(--text-dark);
    line-height: 1.6;
    padding-bottom: 80px;
}

.app-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-purple));
    color: white;
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-medium);
}

.app-header h1 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    text-align: center;
}

.header-stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
}

.stat-label {
    font-size: 0.8rem;
    opacity: 0.9;
}

.main-content {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--background-white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.card h3 {
    margin-bottom: 15px;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.primary-card {
    background: linear-gradient(135deg, var(--primary-blue), var(--success-green));
    color: white;
}

.primary-card h3 {
    color: white;
}

.consumption-display {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-bottom: 10px;
}

.large-number {
    font-size: 2.5rem;
    font-weight: bold;
}

.unit {
    font-size: 1rem;
    opacity: 0.8;
}

.status-indicator {
    padding: 5px 10px;
    border-radius: 20px;
    background: rgba(255,255,255,0.2);
    font-size: 0.9rem;
    text-align: center;
}

.appliances-list {
    margin-bottom: 15px;
}

.appliance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.appliance-item:last-child {
    border-bottom: none;
}

.appliance-name {
    font-weight: 500;
}

.appliance-consumption {
    color: var(--primary-blue);
    font-weight: bold;
}

.cost-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.btn-primary, .btn-secondary, .btn-danger {
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--border-light);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: #d0d0d0;
}

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

.btn-danger:hover {
    background: #d32f2f;
}

canvas {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.analysis-container,
.recommendations-container,
.settings-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.analysis-filters {
    margin-bottom: 20px;
}

.analysis-filters select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.9rem;
}

.peaks-list, .ranking-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.peak-item, .ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--background-light);
    border-radius: 8px;
}

.peak-time, .appliance {
    font-weight: 500;
}

.peak-value, .consumption {
    color: var(--primary-blue);
    font-weight: bold;
}

.rank {
    background: var(--primary-blue);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.recommendation-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: var(--background-light);
    border-radius: 8px;
    border-left: 4px solid var(--success-green);
}

.recommendation-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.recommendation-content h4 {
    margin-bottom: 5px;
    color: var(--text-dark);
}

.recommendation-content p {
    color: var(--text-light);
    margin-bottom: 8px;
}

.potential-savings {
    color: var(--success-green);
    font-weight: bold;
    font-size: 0.9rem;
}

.solar-analysis {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.solar-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.metric-label {
    color: var(--text-light);
}

.metric-value {
    font-weight: bold;
    color: var(--primary-blue);
}

.renewable-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.renewable-item {
    padding: 15px;
    background: var(--background-light);
    border-radius: 8px;
}

.renewable-item h4 {
    margin-bottom: 5px;
    color: var(--text-dark);
}

.renewable-item p {
    color: var(--text-light);
    margin-bottom: 8px;
}

.viability {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--success-green);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input, .form-group select {
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.notification-settings {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.notification-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: var(--transition);
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-blue);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.data-management {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.faq-section {
    margin: 30px 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.faq-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-dark);
}

.faq-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.faq-item {
    background: var(--background-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 20px;
    background: none;
    border: none;
    text-align: left;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq-question:hover {
    background: var(--background-light);
}

.faq-icon {
    font-size: 1.2rem;
    color: var(--primary-blue);
    transition: var(--transition);
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 20px 20px;
    color: var(--text-light);
    line-height: 1.6;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-answer.show {
    max-height: 200px;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--background-white);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-light);
    transition: var(--transition);
    padding: 5px 10px;
    border-radius: 8px;
    min-width: 60px;
}

.nav-item.active {
    color: var(--primary-blue);
    background: rgba(33, 150, 243, 0.1);
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

footer {
    text-align: center;
    padding: 20px;
    background: var(--background-white);
    color: var(--text-light);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-light);
    margin-top: 40px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: var(--background-white);
    margin: 15% auto;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
}

.close:hover {
    color: var(--text-dark);
}

@media (max-width: 768px) {
    .dashboard-grid,
    .analysis-container,
    .recommendations-container,
    .settings-container {
        grid-template-columns: 1fr;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .header-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .data-management {
        flex-direction: column;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 15px;
    }
    
    .app-header h1 {
        font-size: 1.3rem;
    }
    
    .large-number {
        font-size: 2rem;
    }
    
    .card {
        padding: 15px;
    }
    
    .bottom-nav {
        padding: 8px 0;
    }
    
    .nav-item i {
        font-size: 1rem;
    }
    
    .nav-item span {
        font-size: 0.6rem;
    }
}

@media (min-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .analysis-container,
    .recommendations-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .settings-container {
        grid-template-columns: repeat(3, 1fr);
    }
}
