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

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --dark: #2d3748;
    --light: #f7fafc;
    --gray: #a0aec0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 30px;
    text-align: center;
}

.header-content h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.header-content p {
    font-size: 1.1em;
    opacity: 0.9;
    margin-bottom: 15px;
}

.header-icons {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 1.5em;
}

/* Status de Conexão */
.connection-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 25px;
    background: var(--light);
    border-bottom: 1px solid #e2e8f0;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gray);
    animation: pulse 2s infinite;
}

.status-indicator.connected {
    background: var(--success);
}

.status-indicator.error {
    background: var(--danger);
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Estatísticas */
.stats-section {
    padding: 25px;
    border-bottom: 1px solid #e2e8f0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2.5em;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 15px;
}

.stat-content h3 {
    font-size: 0.9em;
    color: var(--gray);
    margin-bottom: 5px;
}

.stat-content span {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--dark);
}

/* Ações */
.actions-section {
    padding: 25px;
    border-bottom: 1px solid #e2e8f0;
}

.actions-section h3 {
    margin-bottom: 20px;
    color: var(--dark);
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.action-btn {
    padding: 25px 15px;
    border: none;
    border-radius: 15px;
    font-weight: 600;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.btn-superiores {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
}

.btn-inferiores {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
}

.btn-cardio {
    background: linear-gradient(135deg, #ffe66d, #fdcb6e);
    color: var(--dark);
}

.action-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.btn-icon {
    font-size: 2em;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    display: none;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Histórico */
.history-section {
    padding: 25px;
}

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

.section-header h3 {
    color: var(--dark);
}

.badge {
    background: var(--primary);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
}

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

.treino-item {
    background: white;
    padding: 25px;
    border-radius: 15px;
    border-left: 5px solid;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
}

.treino-item:hover {
    transform: translateX(5px);
}

.treino-superiores { border-left-color: #4ecdc4; }
.treino-inferiores { border-left-color: #ff6b6b; }
.treino-cardio { border-left-color: #ffe66d; }

.treino-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.treino-data {
    font-size: 0.9em;
    color: var(--gray);
    font-weight: 500;
}

.treino-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.treino-dia {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 600;
}

.treino-grupo {
    background: var(--secondary);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 600;
}

.treino-exercicios {
    margin: 20px 0;
}

.exercicio-lista {
    margin: 12px 0;
    padding: 15px;
    background: var(--light);
    border-radius: 10px;
    border-left: 3px solid var(--primary);
}

.exercicio-nome-list {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
    font-size: 1em;
}

.exercicio-detalhes-list {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    color: var(--gray);
}

.exercicio-detalhes-list span {
    background: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 500;
}

.treino-observacoes {
    font-size: 0.9em;
    color: var(--gray);
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
    font-style: italic;
}

.treino-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.btn-editar {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.btn-editar:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

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

.modal-content {
    background: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 25px 0;
    margin-bottom: 20px;
}

.modal-header h2 {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.close {
    color: var(--gray);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

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

form {
    padding: 0 25px 25px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

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

label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
    font-size: 0.9em;
}

input, select, textarea {
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: white;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Exercícios no Modal */
.exercicios-container {
    margin: 25px 0;
}

.section-title {
    margin-bottom: 15px;
}

.section-title h4 {
    color: var(--dark);
    margin-bottom: 5px;
}

.section-title small {
    color: var(--gray);
}

.exercicio-item {
    background: var(--light);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 2px solid #e2e8f0;
}

.exercicio-header {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.exercicio-header input {
    flex: 1;
}

.btn-remover {
    background: var(--danger);
    color: white;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.exercicio-detalhes {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 0.8em;
    margin-bottom: 5px;
    color: var(--gray);
    font-weight: 500;
}

.input-group input {
    text-align: center;
    padding: 10px;
}

.btn-add-exercicio {
    width: 100%;
    background: var(--light);
    color: var(--primary);
    border: 2px dashed var(--primary);
    padding: 15px;
    margin-bottom: 20px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-add-exercicio:hover {
    background: var(--primary);
    color: white;
    border-style: solid;
}

.form-actions {
    margin-top: 25px;
}

.btn-salvar {
    width: 100%;
    background: linear-gradient(135deg, var(--success), #38a169);
    color: white;
    padding: 18px;
    font-size: 1.1em;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-salvar:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(72, 187, 120, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .actions-grid {
        grid-template-columns: 1fr;
    }
    
    .exercicio-detalhes {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 95%;
    }
    
    .treino-header {
        flex-direction: column;
        align-items: flex-start;
    }
}