/* Reset e Configurações Gerais */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
}

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

/* Evitar rolagem horizontal global */
html, body { overflow-x: hidden; max-width: 100%; }
.panel-container, .main-content, .section-card, .files-list { max-width: 100%; overflow-x: hidden; }

/* Tela de Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.login-header i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-group label {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label i {
    color: var(--primary-color);
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: var(--transition);
    background: var(--bg-color);
    color: var(--text-primary);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.form-group input::placeholder {
    color: #94a3b8;
}

.error-message {
    background: #fef2f2;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: shake 0.4s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Botões */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

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

.btn-logout {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    width: 100%;
}

.btn-logout:hover {
    background: #f1f5f9;
    border-color: var(--text-secondary);
}

.btn-download {
    background: var(--success-color);
    color: white;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-download:hover {
    background: #059669;
}

/* Painel Administrativo */
.panel-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-color);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 32px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header i {
    font-size: 24px;
    color: var(--primary-color);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 24px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.nav-item.active {
    background: #eff6ff;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.nav-item i {
    font-size: 18px;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    min-height: 100vh;
}

.content-header {
    margin-bottom: 32px;
}

.content-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.section-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow);
}

.section-card h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-card h2 i {
    color: var(--primary-color);
}

.section-description {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

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

.badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

/* Upload Area */
.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: 16px;
    padding: 48px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: var(--bg-color);
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #eff6ff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 64px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.upload-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.upload-subtext {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.upload-status {
    background: #ecfdf5;
    border: 1px solid var(--success-color);
    color: var(--success-color);
    padding: 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upload-info {
    margin-top: 20px;
    padding: 12px;
    background: #fef3c7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.upload-info i {
    color: #f59e0b;
}

.upload-info small {
    color: #92400e;
}

/* Files List */
.files-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* Storage Warning */
.storage-warning {
    margin-top: 20px;
    padding: 14px 16px;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: slideDown 0.3s ease-out;
    color: #92400e;
    font-weight: 600;
    font-size: 14px;
}

.storage-warning i {
    color: #f59e0b;
    font-size: 18px;
}

.file-item {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.file-item:hover {
    background: white;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

.file-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), #6366f1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.file-details h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.file-details p {
    font-size: 13px;
    color: var(--text-secondary);
}

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

/* Melhorias de responsividade e usabilidade mobile */
/* Ajustes gerais para truncar textos longos nos nomes de arquivos */
.file-details h3 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.file-details p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

/* Refinar o layout em telas médias */
@media (max-width: 768px) {
    .header-subtitle { font-size: 14px; }
    .content-header h1 { font-size: 24px; }

    .file-icon { width: 40px; height: 40px; font-size: 18px; }

    .btn { padding: 10px 14px; font-size: 14px; }

    .files-list { gap: 10px; }

    .file-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
    }

    .file-info { gap: 12px; }

    .file-actions { width: 100%; }

    .file-actions .btn {
        flex: 1 1 calc(50% - 8px);
        min-width: 140px;
    }
}

/* Ajustes para telas pequenas (smartphones) */
@media (max-width: 480px) {
    .login-card { padding: 24px 18px; border-radius: 16px; }

    .form-group input { padding: 12px; font-size: 16px; }

    .btn { padding: 12px 14px; font-size: 15px; }

    .sidebar { position: static; width: 100%; height: auto; }
    .sidebar-header { padding: 20px 16px; }
    .sidebar-nav { display: flex; gap: 6px; padding: 10px 12px; }
    .nav-item { padding: 10px 12px; font-size: 14px; }

    .main-content { margin-left: 0; padding: 16px; }

    .section-card { padding: 16px; border-radius: 14px; }

    .upload-area { padding: 20px 16px; }
    .upload-text { font-size: 16px; }

    .content-header { margin-bottom: 20px; }

    .file-item { padding: 14px; }

    .file-info { align-items: flex-start; }

    .file-details h3 { font-size: 15px; }
    .file-details p { font-size: 12px; }

    .file-actions { gap: 8px; }
    .file-actions .btn { flex: 1 1 100%; min-width: 0; }

    .badge { font-size: 12px; padding: 3px 10px; }
}

/* Extra pequeno (<=360px) */
@media (max-width: 360px) {
    .login-header h1 { font-size: 22px; }
    .login-header i { font-size: 40px; }
    .nav-item { font-size: 13px; }
    .content-header h1 { font-size: 20px; }
}

/* Ajustes extras de responsividade */
.file-info { flex: 1; min-width: 0; }
.file-details { min-width: 0; }

@media (max-width: 768px) {
    .file-info { width: 100%; flex-wrap: wrap; }
    .file-details h3, .file-details p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .file-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
}

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

/* Layout responsivo reforçado */
@media (max-width: 768px) {
	.panel-container { flex-direction: column; }
	.sidebar { width: 100%; height: auto; position: sticky; top: 0; z-index: 50; border-right: none; border-bottom: 1px solid var(--border-color); }
	.sidebar-header { padding: 16px; }
	.sidebar-nav { display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
	.nav-item { flex: 1 0 auto; text-align: center; border-left: none; border-bottom: 3px solid transparent; padding: 10px 12px; }
	.nav-item.active { border-bottom-color: var(--primary-color); }
	.main-content { margin-left: 0; padding: 16px; }
	.section-card { padding: 16px; }
	.upload-area { padding: 20px 16px; }
}

/* Cards de arquivo fluídos e legíveis no mobile */
@media (max-width: 768px) {
	.files-list { gap: 10px; }
	.file-item { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
	.file-info { display: grid; grid-template-columns: 48px 1fr; gap: 12px; }
	.file-details h3 { font-size: 15px; }
	.file-details p { font-size: 12px; }
	.file-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
	.file-actions .btn { width: 100%; }
}

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

/* Itens de arquivo ocupam 100% e quebram linhas longas */
.file-item { width: 100%; }
.file-details h3, .file-details p {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Em mobile, tudo empilha e ocupa 100% sem scroll lateral */
@media (max-width: 768px) {
    .main-content { width: 100%; box-sizing: border-box; }
    .files-list { width: 100%; }
    .file-info { width: 100%; min-width: 0; }
    .file-details { min-width: 0; }
    .file-actions { width: 100%; }
    .file-actions .btn { min-width: 0; width: 100%; }
}

/* Mobile-first refinements */
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; max-width: 100%; }

/* Evitar elementos expandirem a largura */
img, iframe, video { max-width: 100%; height: auto; display: block; }

/* Badges e textos longos não quebram layout */
.badge { white-space: nowrap; }

/* Cards e listas ocupam sempre 100% */
.section-card, .files-list, .file-item { width: 100%; box-sizing: border-box; }

/* Forçar quebra de linha segura para nomes longos */
.file-details h3, .file-details p, .upload-text, .section-description {
	overflow-wrap: anywhere;
	word-break: break-word;
	white-space: normal;
}

/* Botões se adaptam ao espaço disponível */
.file-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.file-actions .btn { width: 100%; min-width: 0; }

/* Sidebar e layout principal responsivos */
@media (max-width: 1024px) {
	.main-content { padding: 24px; }
}

@media (max-width: 768px) {
	.panel-container { display: block; }
	.sidebar { position: static; width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border-color); }
	.sidebar-header { padding: 16px; }
	.sidebar-nav { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
	.nav-item { flex: 1 0 auto; border-left: none; border-bottom: 3px solid transparent; text-align: center; padding: 10px 12px; }
	.nav-item.active { border-bottom-color: var(--primary-color); }
	.main-content { margin-left: 0; padding: 16px; }
	.section-card { padding: 16px; }
	.upload-area { padding: 16px; }
	.content-header { margin-bottom: 16px; }
	.content-header h1 { font-size: 24px; }
	.header-subtitle { font-size: 14px; }
	.file-item { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; padding: 14px; }
	.file-info { display: grid; grid-template-columns: 44px 1fr; gap: 12px; width: 100%; min-width: 0; }
	.file-icon { width: 44px; height: 44px; font-size: 18px; }
	.file-details h3 { font-size: 15px; }
	.file-details p { font-size: 12px; }
	.file-actions { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
	.file-actions { grid-template-columns: 1fr; }
	.btn { padding: 12px 14px; font-size: 15px; }
	.form-group input { padding: 12px; font-size: 16px; }
	.login-card { padding: 24px 18px; border-radius: 14px; }
}

@media (max-width: 480px) {
	.upload-text { font-size: 16px; }
	.badge { font-size: 12px; padding: 3px 10px; }
}

@media (max-width: 360px) {
	.login-header h1 { font-size: 20px; }
	.login-header i { font-size: 36px; }
	.nav-item { font-size: 13px; }
	.content-header h1 { font-size: 20px; }
}

