﻿/**
 * FORMULÃRIOS UX PROFISSIONAIS - Academia System
 * Design focado na usabilidade dos professores
 * FORÃ‡A ABSOLUTA: Sobrescreve qualquer estilo anterior
 */

/* ==========================================================================
   FORM SYSTEM - UX PROFESSIONAL
   ========================================================================== */

/* Reset para formulÃ¡rios */
.students-module form,
.students-module input,
.students-module textarea,
.students-module select,
.students-module button,
.student-editor-module form,
.student-editor-module input,
.student-editor-module textarea,
.student-editor-module select,
.student-editor-module button {
    background: unset;
    background-image: unset;
    box-sizing: border-box;
}

/* ==========================================================================
   FORM CONTAINERS
   ========================================================================== */

.form-sections {
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: 24px;
    background: var(--color-background);
    min-height: calc(100vh - 200px);
}

.form-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.form-section:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.1);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 24px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
}

.section-icon {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ==========================================================================
   FORM GRID LAYOUT
   ========================================================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group.half-width {
    grid-column: span 1;
}

/* ==========================================================================
   LABELS PROFISSIONAIS
   ========================================================================== */

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group label.required::after {
    content: "*";
    color: var(--color-error);
    font-weight: 700;
    margin-left: 4px;
}

.form-group label .help-icon {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    cursor: help;
    padding: 2px;
}

/* ==========================================================================
   INPUTS MODERNOS E FUNCIONAIS
   ========================================================================== */

.form-control,
.form-input,
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text);
    background: var(--color-surface);
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.form-control:focus,
.form-input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: #fefefe;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1), 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.form-control:hover,
.form-input:hover,
input:hover,
textarea:hover,
select:hover {
    border-color: var(--color-border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Placeholders profissionais */
.form-control::placeholder,
.form-input::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--color-text-light);
    font-weight: 400;
    font-style: italic;
}

/* Estados de validaÃ§Ã£o */
.form-control.valid,
.form-input.valid,
input.valid {
    border-color: var(--color-success);
    background: #f0fdf4;
}

.form-control.invalid,
.form-input.invalid,
input.invalid {
    border-color: var(--color-error);
    background: #fef2f2;
}

/* ==========================================================================
   TEXTAREAS EXPANDIDAS
   ========================================================================== */

textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

textarea.auto-resize {
    resize: none;
    overflow: hidden;
}

/* ==========================================================================
   SELECTS CUSTOMIZADOS
   ========================================================================== */

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M6 9l6 6 6-6'%3e%3c/path%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

select:focus {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M6 9l6 6 6-6'%3e%3c/path%3e%3c/svg%3e");
}

/* ==========================================================================
   VALIDATION ERRORS CLAROS
   ========================================================================== */

.field-error {
    font-size: 0.8rem;
    color: var(--color-error);
    font-weight: 500;
    margin-top: 4px;
    padding-left: 4px;
    min-height: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-error:not(:empty)::before {
    content: "âš ï¸";
    font-size: 0.75rem;
}

.field-success {
    font-size: 0.8rem;
    color: var(--color-success);
    font-weight: 500;
    margin-top: 4px;
    padding-left: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-success::before {
    content: "âœ…";
    font-size: 0.75rem;
}

/* ==========================================================================
   BUTTONS DE AÃ‡ÃƒO PROFISSIONAIS
   ========================================================================== */

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 24px 32px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    border-radius: 0 0 16px 16px;
    margin-top: 32px;
}

.btn-form {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    min-width: 120px;
    justify-content: center;
}

.btn-primary-form {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.btn-primary-form:hover {
    background: linear-gradient(135deg, var(--primary-light), #7c3aed);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.4);
}

.btn-secondary-form {
    background: var(--color-background);
    color: #374151;
    border: 2px solid var(--color-border);
}

.btn-secondary-form:hover {
    background: #f1f5f9;
    border-color: var(--color-border);
    transform: translateY(-1px);
}

.btn-danger-form {
    background: var(--color-error);
    color: white;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

.btn-danger-form:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.4);
}

/* Loading states para botÃµes */
.btn-form.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-form.loading::after {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

/* ==========================================================================
   FORM TABS NAVIGATION
   ========================================================================== */

.tab-navigation {
    display: flex;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px 12px 0 0;
    padding: 4px;
    margin: 24px 24px 0 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background: var(--color-background);
    color: #374151;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.tab-icon {
    font-size: 1.1rem;
}

.tab-text {
    font-weight: 600;
}

/* ==========================================================================
   PROGRESS INDICATOR
   ========================================================================== */

.progress-indicator {
    background: var(--color-surface);
    padding: 12px 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 16px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--color-success), #059669);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-weight: 500;
    white-space: nowrap;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .form-sections {
        padding: 16px;
        gap: 20px;
    }
    
    .form-section {
        padding: 20px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .btn-form {
        width: 100%;
    }
    
    .tab-navigation {
        margin: 16px 16px 0 16px;
        padding: 2px;
    }
    
    .tab-btn {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    .tab-text {
        display: none;
    }
    
    .tab-icon {
        font-size: 1.2rem;
    }
}

@media (max-width: 576px) {
    .form-control,
    .form-input,
    input,
    textarea,
    select {
        font-size: 16px; /* Previne zoom no iOS */
    }
    
    .section-title {
        font-size: 1.1rem;
    }
    
    .form-section {
        padding: 16px;
    }
}

/* ==========================================================================
   LOADING STATES PARA FORMULÃRIOS
   ========================================================================== */

.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.form-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
}

.form-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    border: 3px solid var(--color-border);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
    z-index: 11;
}

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

/* ==========================================================================
   SEARCH AND FILTERS SECTIONS
   ========================================================================== */

.search-filters-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 24px;
    margin: 0 24px 24px 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: end;
}

.view-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px 16px 24px;
    background: var(--color-background);
}

.view-options {
    display: flex;
    gap: 4px;
    background: var(--color-surface);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
}

.view-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-btn:hover {
    background: var(--color-background);
    color: #374151;
}

.view-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}

.view-icon {
    font-size: 1rem;
}

.results-info {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

/* ==========================================================================
   EMPTY AND ERROR STATES
   ========================================================================== */

.empty-state,
.error-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    margin: 0 24px;
}

.empty-icon,
.error-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state h3,
.error-state h3 {
    font-size: 1.25rem;
    color: var(--color-text);
    margin-bottom: 8px;
    font-weight: 600;
}

.empty-state p,
.error-state p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 24px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   RESPONSIVE DESIGN PARA SEARCH
   ========================================================================== */

@media (max-width: 768px) {
    .search-filters-section {
        margin: 0 16px 16px 16px;
        padding: 16px;
    }
    
    .filter-group {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .view-controls {
        padding: 0 16px 12px 16px;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .view-options {
        justify-content: center;
    }
    
    .results-info {
        text-align: center;
    }
    
    .empty-state,
    .error-state {
        margin: 0 16px;
        padding: 40px 16px;
    }
}

@media (max-width: 576px) {
    .view-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .view-btn .view-icon {
        font-size: 0.9rem;
    }
    
    .empty-icon,
    .error-icon {
        font-size: 3rem;
    }
    
    .search-container {
        gap: 16px;
    }
}

.form-control:focus-visible,
.form-input:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.btn-form:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-control,
    .form-input,
    input,
    textarea,
    select {
        border-width: 3px;
    }
    
    .btn-form {
        border: 2px solid currentColor;
    }
}

/* ==========================================================================
   TOOLTIPS E HELP TEXT
   ========================================================================== */

.form-help {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.form-help.success {
    color: var(--color-success);
}

.form-help.warning {
    color: var(--color-warning);
}

/* Tooltip container */
.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip-content {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-text);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

.tooltip-container:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
}

.tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--color-text);
}

