/* Reset e configurações básicas */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* PWA Install Button */
.install-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    z-index: 1000;
    transition: all 0.3s ease;
}

.install-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* Container principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* === TELA DE LOGIN === */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    width: 100%;
    backdrop-filter: blur(10px);
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.login-header p {
    color: #666;
    font-size: 16px;
}

/* Grid de usuários */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.user-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.user-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.user-avatar.child {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.user-avatar.parent {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.user-card h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.user-type {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
}

.user-points {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
    color: #667eea;
}

.no-users-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-users-message i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #ccc;
}

/* === DASHBOARD === */
.dashboard {
    min-height: 100vh;
}

.dashboard-header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-details h2 {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}

.user-points {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #667eea;
    font-size: 16px;
}

#currentUserAvatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

body.child #currentUserAvatar {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

body.parent #currentUserAvatar {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

/* Navegação */
.navigation {
    display: flex;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 8px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    overflow-x: auto;
    gap: 4px;
}

.nav-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 16px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #666;
    font-weight: 500;
    min-width: 100px;
}

.nav-btn i {
    font-size: 20px;
}

.nav-btn span {
    font-size: 12px;
}

.nav-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.nav-btn.active {
    background: #667eea;
    color: white;
}

/* Seções */
.section {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
}

.section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header h3 {
    font-size: 28px;
    font-weight: 700;
    color: #333;
}

.section-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Filtros */
.filters {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    background: white;
    color: #333;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
}

/* Grids */
.tasks-grid,
.rewards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Cards de Tarefa */
.task-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border-left: 4px solid #667eea;
}

.task-card.completed {
    border-left-color: #28a745;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.task-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.task-info {
    flex: 1;
}

.task-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.task-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 14px;
}

.task-points {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    color: #667eea;
}

.task-assignee {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
}

.task-due-date {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
}

.task-due-date.overdue {
    color: #dc3545;
    font-weight: 600;
}

.task-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.task-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.task-status.pendente {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.task-status.concluida {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

/* Cards de Recompensa */
.reward-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border-left: 4px solid #28a745;
    text-align: center;
}

.reward-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.reward-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.reward-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.reward-cost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

.reward-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Ranking */
.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ranking-item {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.ranking-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.ranking-position {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.ranking-item:nth-child(1) .ranking-position {
    background: linear-gradient(135deg, #FFD700, #FFA500);
}

.ranking-item:nth-child(2) .ranking-position {
    background: linear-gradient(135deg, #C0C0C0, #A0A0A0);
}

.ranking-item:nth-child(3) .ranking-position {
    background: linear-gradient(135deg, #CD7F32, #8B4513);
}

.ranking-item:nth-child(n+4) .ranking-position {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.ranking-user {
    flex: 1;
}

.ranking-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.ranking-stats {
    color: #666;
    font-size: 14px;
}

.ranking-points {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
}

/* Gráficos */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.chart-container {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.chart-container h4 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    justify-content: center;
    min-width: auto;
}

.btn-primary {
    background: #667eea;
    color: white;
}

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

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-1px);
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    transform: translateY(-1px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.btn-small {
    padding: 8px 12px;
    font-size: 12px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* === MODAIS === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 24px 32px 16px;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 4px;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 24px 32px;
}

.modal-actions {
    padding: 16px 32px 32px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Formulários */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Seletor de Avatar */
.avatar-selector {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.avatar-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
    background: linear-gradient(135deg, #ccc, #999);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.avatar-option:hover {
    transform: scale(1.1);
}

.avatar-option.selected {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #667eea;
    transform: scale(1.1);
}

/* Estados vazios */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #ccc;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

/* Responsivo */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .login-container {
        padding: 24px;
    }
    
    .login-header h1 {
        font-size: 24px;
    }
    
    .users-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .user-avatar {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }
    
    .dashboard-header {
        padding: 20px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .navigation {
        padding: 4px;
    }
    
    .nav-btn {
        padding: 12px 8px;
        min-width: 80px;
    }
    
    .nav-btn span {
        font-size: 11px;
    }
    
    .section {
        padding: 20px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .section-actions {
        justify-content: center;
    }
    
    .tasks-grid,
    .rewards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .ranking-item {
        padding: 16px;
        gap: 12px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header,
    .modal-body,
    .modal-actions {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .avatar-selector {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .user-card {
        padding: 16px;
    }
    
    .task-card,
    .reward-card {
        padding: 16px;
    }
    
    .task-actions,
    .reward-actions {
        justify-content: center;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 12px;
    }
}