/* ============================================
   RESET E VARIÁVEIS
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6;
    --primary-dark: #1e40af;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #06b6d4;
    --dark: #1f2937;
    --light: #f3f4f6;
    --border: #e5e7eb;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 2rem;
    color: #1f2937;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    color: white;
}

#loadingOverlay .spinner {
    font-size: 4rem;
    margin-bottom: 2rem;
    animation: pulse 1.5s ease-in-out infinite;
}

#loadingOverlay h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

#loadingOverlay p {
    font-size: 1.2rem;
    opacity: 0.9;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
}

/* ============================================
   CONTAINER PRINCIPAL
   ============================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* ============================================
   HEADER
   ============================================ */

header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* ============================================
   NAVEGAÇÃO
   ============================================ */

nav {
    background: #1f2937;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

nav a {
    color: white;
    text-decoration: none;
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

nav a:hover {
    background: #374151;
    border-bottom-color: #3b82f6;
}

nav a i {
    font-size: 1.3rem;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

main {
    padding: 2rem;
    min-height: 500px;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}

.card h2, .card h3 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card ul {
    margin-left: 2rem;
    line-height: 1.8;
}

.card ul li {
    margin-bottom: 0.5rem;
}

/* ============================================
   BOTÕES
   ============================================ */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-info {
    background: var(--info);
}

.btn-info:hover {
    background: #0891b2;
}

.btn-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* ============================================
   DASHBOARD
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.stat-card i {
    font-size: 3rem;
    opacity: 0.8;
    margin-bottom: 1rem;
}

.stat-card h3 {
    font-size: 2.5rem;
    margin: 0.5rem 0;
    color: white;
}

.stat-card p {
    opacity: 0.9;
    font-size: 1.1rem;
}

/* ============================================
   FORMULÁRIOS
   ============================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ============================================
   MODAL
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: auto;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 1000px;
    width: 100%;
    max-height: 95vh;
    overflow: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--primary-dark);
    font-size: 1.8rem;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 0.5rem;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-content h4 {
    margin: 0 0 1rem 0;
    color: var(--primary-dark);
    font-size: 1.1rem;
}

/* Seções coloridas */
.modal-content .card:nth-child(2) {
    background: #f0f9ff;
    border-color: #bae6fd;
}

.modal-content .card:nth-child(3) {
    background: #fef3c7;
    border-color: #fde68a;
}

.modal-content .card:nth-child(4) {
    background: #fce7f3;
    border-color: #fbcfe8;
}

/* ============================================
   CARACTERÍSTICAS
   ============================================ */

#characteristicsContainer > div,
#characteristicsForm > div {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: white;
    transition: all 0.3s;
}

#characteristicsContainer > div:hover,
#characteristicsForm > div:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

#characteristicsContainer > div > div:first-child,
#characteristicsForm > div > div:first-child {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}

#characteristicsContainer > div > div:first-child:hover,
#characteristicsForm > div > div:first-child:hover {
    background: #f3f4f6;
}

#characteristicsContainer input[type="checkbox"],
#characteristicsForm input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-right: 1rem;
}

#characteristicsContainer i[class*="fa-"],
#characteristicsForm i[class*="fa-"] {
    font-size: 1.5rem;
    margin-right: 1rem;
}

#characteristicsContainer i[id^="arrow_"],
#characteristicsForm i[id^="arrow_"] {
    color: #9ca3af;
    transition: transform 0.3s;
    margin-left: auto;
}

/* Sub-características */
[id^="subchars_"] {
    margin-left: 3rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
    margin-top: 1rem;
}

[id^="subchars_"] > div {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 4px solid var(--primary);
}

[id^="subchars_"] label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

[id^="subchars_"] p {
    margin: 0 0 0.75rem 0;
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.5;
}

[id^="subchars_"] > div > div {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Sliders */
input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="range"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

[id^="value_"] {
    font-weight: bold;
    font-size: 1.3rem;
    min-width: 60px;
    text-align: center;
    padding: 0.25rem 0.75rem;
    background: white;
    border-radius: 6px;
    border: 2px solid #e5e7eb;
}

[id^="subchars_"] > div > div:last-child {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.5rem;
    padding: 0 0.25rem;
}

/* ============================================
   LISTA DE ALUNOS
   ============================================ */

.student-card {
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: white;
    transition: all 0.3s;
}

.student-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.student-card h4 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-dark);
    font-size: 1.2rem;
}

.student-card p {
    margin: 0.25rem 0;
    color: #6b7280;
}

.student-card .btn-group {
    margin-top: 1rem;
    margin-bottom: 0;
}

/* ============================================
   RESPONSIVO
   ============================================ */

@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .container {
        border-radius: 0;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    nav {
        flex-direction: column;
    }
    
    nav a {
        padding: 1rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    [id^="subchars_"] {
        margin-left: 1rem;
    }
    
    .modal-content {
        padding: 1rem;
    }
}

/* ============================================
   UTILITÁRIOS
   ============================================ */

.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.hidden {
    display: none !important;
}
/* ==========================================
   CARACTERÍSTICAS E SLIDERS
   ========================================== */

.characteristic-group {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.characteristic-group:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.characteristic-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.characteristic-header i {
    font-size: 1.5rem;
    color: #3b82f6;
}

.characteristic-header h4 {
    margin: 0;
    color: #1e40af;
    font-size: 1.1rem;
}

.slider-container {
    position: relative;
}

.characteristic-slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, 
        #10b981 0%, 
        #3b82f6 30%, 
        #f59e0b 60%, 
        #dc2626 100%);
    outline: none;
    -webkit-appearance: none;
    margin: 1rem 0;
}

.characteristic-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: 3px solid #3b82f6;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.characteristic-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.characteristic-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: 3px solid #3b82f6;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.characteristic-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.characteristic-value {
    text-align: center;
    font-weight: 600;
    color: #1e40af;
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f0f9ff;
    border-radius: 8px;
    font-size: 1rem;
}

/* Cards de alunos e histórico */
.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.student-card,
.history-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.student-card:hover,
.history-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

.student-header,
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f3f4f6;
}

.student-header h3,
.history-header h3 {
    margin: 0 0 0.5rem 0;
    color: #1e40af;
    font-size: 1.2rem;
}

.student-header p,
.history-header p {
    margin: 0;
    color: #6b7280;
    font-size: 0.9rem;
}

.student-age {
    background: #3b82f6;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.history-date {
    background: #f3f4f6;
    color: #6b7280;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    text-align: right;
}

.student-diagnosis {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    color: #92400e;
    font-size: 0.9rem;
}

.student-characteristics {
    background: #f0f9ff;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    color: #1e40af;
    font-size: 0.9rem;
}

/* Responsividade */
@media (max-width: 768px) {
    .students-grid {
        grid-template-columns: 1fr;
    }
    
    .student-header,
    .history-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .student-age,
    .history-date {
        align-self: flex-start;
    }
}
