/* public/assets/css/style.css */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --sidebar-bg: rgba(30, 27, 75, 0.95);
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-main);
}

/* Layout Structure */
.layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    color: white;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 50px;
    position: sticky;
    top: 0;
    height: 100vh;
    box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    z-index: 100;
}

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

.logo-icon {
    background: var(--primary);
    color: white;
    padding: 8px 12px;
    border-radius: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.logo span {
    font-weight: 600;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
}

nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 20px;
    border-radius: 14px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

.nav-item .icon {
    font-size: 1.3rem;
}

/* Main Container */
.container {
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 60px 40px;
}

header {
    text-align: left;
    margin-bottom: 45px;
}

header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    color: #1e1b4b;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Search Box */
.search-section {
    margin-bottom: 40px;
    animation: fadeIn 0.5s ease-out;
}

.search-box {
    position: relative;
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 8px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 16px 24px;
    font-size: 1.1rem;
    outline: none;
    color: var(--text-main);
}

.search-box button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 0 32px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-tip {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 12px;
    margin-left: 15px;
}

/* Results Customization */
.results-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Single Result View (Student Detail) */
.results-list.detail-view {
    display: block;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: transform 0.3s ease;
    animation: fadeIn 0.4s ease-out forwards;
}

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

.card h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    color: var(--primary);
}

.card.clickable {
    cursor: pointer;
    border-left: 5px solid transparent;
}

.card.clickable:hover {
    transform: translateX(5px);
    border-left-color: var(--primary);
    background: white;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.badge {
    display: inline-block;
    padding: 5px 14px;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.badge-outline {
    display: inline-block;
    padding: 3px 10px;
    border: 1.5px solid #cbd5e1;
    color: #64748b;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.icon-small {
    font-size: 1rem;
    margin-right: 5px;
}

.text-mini {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Detail View Layout */
.detail-header {
    margin-bottom: 25px;
    border-left: 8px solid var(--primary);
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    animation: fadeIn 0.5s ease-out;
}

@media (max-width: 480px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
}

.info-card h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    color: #1e1b4b;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.info-item {
    margin-bottom: 15px;
}

.info-item label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.info-item p {
    font-weight: 500;
    color: var(--text-main);
}

.info-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.maps-container {
    display: flex;
    gap: 12px;
    margin-top: 25px;
}

.maps-link {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.95rem;
    background: #10b981;
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.maps-link:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.3);
}

/* History Table */
.history-container {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    overflow: hidden;
    margin-top: 30px;
    box-shadow: var(--shadow);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    background: rgba(79, 70, 229, 0.05);
    padding: 16px 20px;
    text-align: left;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 2px solid #e2e8f0;
}

.history-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
}

.history-table tr.active-row {
    background: rgba(34, 197, 94, 0.05);
}

.status-pill {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 800;
}

.status-ativo { background: #dcfce7; color: #166534; }
.status-outros { background: #f1f5f9; color: #475569; }

/* Animations & Utilities */
.loading-spinner { display: none; text-align: center; padding: 40px; }
.loading-spinner::after {
    content: ""; display: inline-block; width: 40px; height: 40px;
    border: 5px solid #e2e8f0; border-top: 5px solid var(--primary);
    border-radius: 50%; animation: spin 1s linear infinite;
}


/* Form Styles */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 35px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.6);
    max-width: 600px;
    margin: 20px auto;
    animation: fadeIn 0.5s ease-out;
}

.form-header {
    margin-bottom: 25px;
    text-align: center;
}

.form-header h2 {
    color: #1e1b4b;
    font-size: 1.6rem;
    font-weight: 800;
}

.form-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: #4b5563;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.2s;
    outline: none;
    color: var(--text-main);
}

.custom-input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.custom-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234b5563'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 18px;
    padding-right: 45px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 24px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.3);
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    user-select: none;
    transition: color 0.2s;
}

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


/* User Grid & Cards */
.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.user-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    padding: 25px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.user-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.15);
    background: white;
}

.user-avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.2);
}

.user-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

.edit-user-btn, .delete-user-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.9rem;
    background: #f1f5f9;
}

.edit-user-btn { color: var(--primary); }
.edit-user-btn:hover { background: var(--primary); color: white; }

.delete-user-btn { color: #ef4444; }
.delete-user-btn:hover { background: #fee2e2; color: #b91c1c; }

.user-info h3 {
    font-size: 1.1rem;
    color: #1e1b4b;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeInModal 0.3s ease-out;
}

.modal-content {
    background: white;
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    transform: scale(0.9);
    animation: scaleUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

@keyframes fadeInModal { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleUpModal { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

.empty-state { text-align: center; padding: 60px; color: var(--text-muted); font-size: 1.1rem; }

/* Grid de Turmas */
.classes-table-container {
    margin-top: 30px;
    grid-column: 1 / -1;
    animation: fadeIn 0.4s ease-out;
}

.classes-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.classes-table th {
    background: #f8fafc;
    padding: 15px 20px;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
}

.classes-table td {
    padding: 15px 20px;
    font-size: 0.95rem;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
}

.classes-table tr:last-child td {
    border-bottom: none;
}

.classes-table tr:hover {
    background: #f1f5f9;
}

.period-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.period-manha { background: #fef9c3; color: #a16207; }
.period-tarde { background: #ffedd5; color: #9a3412; }
.period-noite { background: #e0e7ff; color: #3730a3; }
.period-integral { background: #dcfce7; color: #166534; }

.enrollment-count {
    font-weight: 800;
    color: var(--primary);
}

@media (max-width: 768px) {
    .sidebar { width: 80px; padding: 20px 10px; }
    .sidebar span, .sidebar .logo span { display: none; }
    .container { padding: 30px 20px; }
    header h1 { font-size: 2rem; }
}
