
/* resources/css/app.css
    Modernização: variáveis de tema, suporte a dark mode (Bootstrap 5.3 data-bs-theme),
    hotfix de paginação consolidado e pequenos utilitários. */

/* Variáveis de cor (usadas no dashboard/Chart) */
:root {
  --c-primary: #2E8BC0;
  --c-deep:    #003F5C;
  --c-mint:    #A8D5BA;

  /* Cores base do layout */
  --bg-body: #ffffff;
  --fg-body: #212529;
  --bg-card: #ffffff;
  --fg-muted: #6c757d;
}

/* Dark mode via data attribute (Bootstrap 5.3) */
:root[data-bs-theme="dark"] {
  color-scheme: dark;
  --bg-body: #0f1216;
  --fg-body: #e9ecef;
  --bg-card: #151a21;
  --fg-muted: #a7b0ba;

  /* Ajustes de contraste para os gráficos */
  --c-primary: #4ea1d3;
  --c-deep:    #1c2a3a;
  --c-mint:    #9ad4c0;
}

/* Reset básico do corpo com variáveis */
html, body {
  background-color: var(--bg-body);
  color: var(--fg-body);
}

/* Cards suaves no dark mode */
.card {
  background-color: var(--bg-card);
}

/* Muted text coerente */
.text-muted { color: var(--fg-muted) !important; }

/* Navbar: manter legibilidade no dark */
.navbar.navbar-dark {
  background: linear-gradient(90deg, #0d6efd 0%, #0a58ca 100%);
}
:root[data-bs-theme="dark"] .navbar.navbar-dark {
  background: linear-gradient(90deg, #0b5ed7 0%, #093f8f 100%);
}

/* Botão pequeno consistente */
.btn.btn-sm {
  line-height: 1.1;
}

/* Conteúdo “soft” para footers e caixas informativas */
.soft-bg {
  background-color: rgba(0,0,0,.03);
  border-radius: .5rem;
}
:root[data-bs-theme="dark"] .soft-bg {
  background-color: rgba(255,255,255,.04);
}
.footer-note { color: var(--fg-muted); }

/* Utilitários comuns */
.link-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

/* Hotfix de paginação (consolida estilos antes inline) */
.pagination { gap:.25rem; --bs-pagination-font-size:.90rem; --bs-pagination-padding-x:.5rem; --bs-pagination-padding-y:.35rem; }
.pagination .page-link { display:inline-flex; align-items:center; justify-content:center; line-height:1.2; }

/* Ícones como FONTE (Bootstrap Icons usa ::before) */
.pagination .page-link .bi,
.pagination .page-link .bi::before,
.pagination .page-link [class^="bi-"],
.pagination .page-link [class*=" bi-"],
.pagination .page-link i.bi,
.pagination .page-link span.bi,
.pagination .page-link span.bi::before {
  font-size:1rem !important;
  line-height:1 !important;
  vertical-align:-.125em;
}

/* Ícones como SVG inline (ou feather) */
.pagination .page-link svg,
.pagination .page-link svg.bi,
.pagination .page-link [data-feather] {
  width:1em !important; height:1em !important; vertical-align:-.125em;
}
/* Se o SVG vier com atributos width/height forçando tamanho, sobrescreve */
.pagination .page-link svg[width]  { width:1em !important; }
.pagination .page-link svg[height] { height:1em !important; }

/* Último nível de defesa: nada dentro do link pode passar de 1.25em */
.pagination .page-link > * { max-width:1.25em !important; max-height:1.25em !important; }

/* Ajustes de tabelas no dark */
:root[data-bs-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255,255,255,.04);
  --bs-table-striped-color: var(--fg-body);
  --bs-table-hover-bg: rgba(255,255,255,.06);
  --bs-table-hover-color: var(--fg-body);
}

/* Badges com bom contraste no dark */
:root[data-bs-theme="dark"] .badge.bg-secondary-subtle {
  background-color: rgba(255,255,255,.08) !important;
  color: var(--fg-body) !important;
}

/* Inputs no dark */
:root[data-bs-theme="dark"] .form-control,
:root[data-bs-theme="dark"] .form-select {
  background-color: #0f141a;
  color: var(--fg-body);
  border-color: rgba(255,255,255,.1);
}
:root[data-bs-theme="dark"] .form-control:focus,
:root[data-bs-theme="dark"] .form-select:focus {
  background-color: #0f141a;
  color: var(--fg-body);
}

/* Botões outline no dark */
:root[data-bs-theme="dark"] .btn-outline-light {
  --bs-btn-color: #e9ecef;
  --bs-btn-border-color: rgba(255,255,255,.35);
  --bs-btn-hover-bg: rgba(255,255,255,.1);
  --bs-btn-hover-border-color: rgba(255,255,255,.5);
}

/* --- File Manager --- */
.file-manager-card {
    position: relative;
    border: 2px dashed transparent;
    transition: border-color 0.2s;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.file-item {
    cursor: pointer;
    padding: 0.5rem;
    text-align: center;
    border-radius: 0.375rem;
    transition: background-color 0.2s;
    word-break: break-word;
}

.file-item:hover {
    background-color: rgba(0,0,0,0.05);
}

.file-name {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.file-icon {
    font-size: 3rem; /* Tamanho do ícone de pasta */
}

.file-preview {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 0.25rem;
}


/* -- Drag and Drop Overlay -- */
.drag-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 123, 255, 0.1);
    border: 2px dashed #007bff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
}


/* -- Lightbox -- */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

.lightbox-close-button {
    position: absolute;
    top: -10px;
    right: -10px;
    background: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.lightbox-caption {
    color: white;
    text-align: center;
    margin-top: 0.5rem;
}

.file-item.selected {
    background-color: rgba(0, 123, 255, 0.2);
    border: 1px solid #007bff;
}

.image-item {
    position: relative; /* Necessário para o posicionamento do botão */
}

.copy-link-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 5;
    
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.2s, transform 0.2s;
    cursor: pointer;
}

.image-item:hover .copy-link-button {
    opacity: 1;
    transform: scale(1);
}

.copy-link-button:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

/* --- List View --- */
.file-list .table {
    vertical-align: middle;
}
.file-list .folder-row, .file-list .file-row {
    cursor: pointer;
}
.file-list .list-preview {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 0.25rem;
}


/* --- Copy Button Refinement --- */
.copy-link-button {
    /* Posicionamento */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    
    /* Aparência */
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Animação */
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    transition: opacity 0.2s, transform 0.2s;
    cursor: pointer;
}

.image-item:hover .copy-link-button {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.image-item:hover .file-preview {
    filter: brightness(0.7);
    transition: filter 0.2s;
}

.copy-link-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.file-item-actions {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.5rem;
    display: flex;
    gap: 0.5rem;
    
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 6;
}

.image-item:hover .file-item-actions {
    opacity: 1;
}

.action-button {
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.action-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
}
.copy-button { /* Legado, remover depois */ }
.delete-button:hover {
    background-color: #dc3545;
}

.folder-item:hover .file-item-actions {
    opacity: 1;
}

/* --- Lógica de Seleção --- */
.file-item {
    position: relative; /* Para o indicador */
}

.selection-indicator {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    background-color: rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s;
    z-index: 7;
}

.file-item.selected .selection-indicator {
    opacity: 1;
    transform: scale(1);
    background-color: #0d6efd;
}

.file-item.selected {
    outline: 2px solid #0d6efd;
    background-color: rgba(13, 110, 253, 0.1);
}

.selected-row {
    background-color: rgba(13, 110, 253, 0.1) !important;
}
