@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-dark: #1a1a2e;
    --sidebar-bg: #1f1f38;
    --glass-bg: rgba(31, 31, 56, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-light: #f0f0f0;
    --text-muted: #a0a0b0;
    --primary-gradient: linear-gradient(90deg, #6a11cb 0%, #2575fc 100%);
    --primary-color: #4a47e3;
    --button-copy-bg: #2ecc71;
    --button-copy-hover: #27ae60;
    --sidebar-width: 260px;
}

/* Reset Básico e Estilos Globais */


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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

/* EFEITO DE FUNDO PARA TODAS AS PÁGINAS */
.background-effect {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.background-effect::before, .background-effect::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.5;
    
}

.background-effect::before {
    background: linear-gradient(135deg, #6F2CFF 0%, #2575fc 100%);
    width: 400px;
    height: 400px;
    top: 10%;
    left: 15%;
    animation: move-light1 15s ease-in-out infinite;
}

.background-effect::after {
    background: linear-gradient(135deg, #00C4FF 0%, #0598fa 100%);
    width: 500px;
    height: 500px;
    bottom: 5%;
    right: 10%;
    animation: move-light1 10s ease-in-out infinite;
}

/* --- ESTILOS PARA PÁGINAS SIMPLES (LOGIN, 404, EXPIRADO) --- */
.container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    padding: 40px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.status-page-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}
.status-page-content h1 { color: var(--text-light); margin-bottom: 0; font-size: 2em; }
.status-icon { color: var(--text-light); opacity: 0.8; }
.status-message { font-size: 1.1em; color: var(--text-muted); max-width: 90%; line-height: 1.6; }

.cta-button {
    display: inline-block;
    width: 100%;
    max-width: 300px;
    padding: 16px 30px;
    border: none;
    background: var(--primary-gradient);
    color: white;
    font-size: 17px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    box-sizing: border-box;
}
.cta-button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); }

/* --- ESTILOS PARA O LAYOUT DO DASHBOARD --- */
.app-layout {
    display: flex;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    z-index: 100;
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.main-content {
    width: 100%;
    min-height: 100vh;
    padding-left: var(--sidebar-width); 
    position: relative; 
    transition: padding-left 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

body.sidebar-collapsed .main-content {
    padding-left: 80px; 
}

/* --- BOTÃO DE MENU E ANIMAÇÕES --- */
.sidebar-toggle-button {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-light);
    border-radius: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: fixed;
    top: 30px;
    left: 30px;
    z-index: 101;
    transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}
.sidebar-toggle-button svg { transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1); }
.sidebar-toggle-button line { transition: stroke 0.4s cubic-bezier(0.25, 0.1, 0.25, 1); }

body:not(.sidebar-collapsed) .sidebar-toggle-button {
    background: white;
    transform: translateX(var(--sidebar-width));
}
body:not(.sidebar-collapsed) .sidebar-toggle-button svg {
    transform: rotate(90deg);
}
body:not(.sidebar-collapsed) .sidebar-toggle-button svg line {
    stroke: var(--sidebar-bg);
}


/* --- ESTILOS DOS COMPONENTES DO DASHBOARD --- */
.sidebar-header {
    display: flex; align-items: center; gap: 12px;
    padding-bottom: 20px; margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
}
.sidebar-header .logo { width: 32px; height: 32px; }
.sidebar-header .brand-name { font-size: 20px; font-weight: 700; white-space: nowrap; }
.sidebar-nav { display: flex; flex-direction: column; gap: 8px; }
.nav-link {
    display: flex; align-items: center; gap: 16px; padding: 12px;
    border-radius: 8px; text-decoration: none; color: var(--text-muted);
    font-weight: 500; transition: background-color 0.2s, color 0.2s; white-space: nowrap;
}
.nav-link svg { width: 24px; height: 24px; flex-shrink: 0; }
.nav-link:hover { background-color: rgba(255,255,255,0.05); color: var(--text-light); }
.nav-link.active { background-color: var(--primary-color); color: white; }
.sidebar-footer { margin-top: auto; }
.sidebar.collapsed .brand-name, .sidebar.collapsed .nav-link span { display: none; }
.sidebar.collapsed .sidebar-header, .sidebar.collapsed .nav-link { justify-content: center; }

.glass-container {
    width: 100%; max-width: 600px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    padding: 40px;
    display: flex; flex-direction: column; gap: 30px; text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.glass-container h1 { font-size: 2em; margin-bottom: 0; color: var(--text-light); }
.glass-container p { color: var(--text-muted); text-align: center; margin-top: -20px; }

#shorten-form { display: flex; flex-direction: column; gap: 20px; }
#title-input, #url-input { /* Adicionado o #title-input aqui */
    width: 100%; padding: 18px 20px; border: 1px solid var(--glass-border);
    background-color: rgba(0, 0, 0, 0.2); color: var(--text-light);
    border-radius: 12px; font-size: 17px;
    transition: border-color 0.3s, background-color 0.3s; box-sizing: border-box;
}
#title-input:focus, #url-input:focus { outline: none; border-color: var(--primary-color); }

.expiration-section { width: 100%; text-align: center; }
.expiration-section h2 { font-size: 1.1em; font-weight: 600; color: var(--text-light); margin-top: 0; margin-bottom: 20px; }
.options-container { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.option-button {
    background: transparent; border: 1px solid var(--glass-border); color: var(--text-muted);
    padding: 10px 20px; border-radius: 10px; font-size: 15px;
    font-weight: 500; cursor: pointer; transition: all 0.3s ease;
}
.option-button:hover { border-color: rgba(255, 255, 255, 0.5); color: var(--text-light); }
.option-button.active {
    background-color: var(--text-light); color: var(--bg-dark); border-color: var(--text-light);
    font-weight: 700; box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.submit-button {
    width: 100%; padding: 18px 30px; border: none; background: var(--primary-gradient);
    color: white; font-size: 18px; font-weight: 700; border-radius: 12px; cursor: pointer;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
.submit-button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); }

/* ESTILOS DO POPUP */
.popup-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6); backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 1; transition: opacity 0.3s ease, visibility 0.3s;
}
.popup-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.popup-content {
    background: #2b2b4e; border: 1px solid var(--glass-border); border-radius: 20px;
    padding: 30px 40px; width: 100%; max-width: 500px; text-align: center;
    position: relative; box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    transform: scale(1); transition: transform 0.3s ease;
}
.popup-overlay.hidden .popup-content { transform: scale(0.9); }
.popup-content h2 { margin-bottom: 25px; font-size: 1.8em; }
.popup-close-button {
    position: absolute; top: 15px; right: 15px; background: none; border: none;
    color: var(--text-muted); font-size: 28px; line-height: 1; cursor: pointer; transition: color 0.2s;
}
.popup-close-button:hover { color: var(--text-light); }
.popup-content .result-box {
    display: flex; align-items: center; justify-content: space-between;
    background-color: rgba(0,0,0,0.2); border-radius: 12px;
    padding: 12px 20px; margin-bottom: 15px;
}
#popup-short-url { font-size: 1.1em; color: #00C4FF; text-decoration: none; word-break: break-all; font-weight: 500; }
#popup-copy-button {
    background-color: var(--button-copy-bg); font-size: 15px; padding: 10px 18px;
    margin-left: 15px; border: none; border-radius: 8px; color: white; cursor: pointer;
}
#popup-copy-button:hover { background-color: var(--button-copy-hover); }
#popup-copy-feedback { height: 20px; margin-bottom: 25px; color: var(--button-copy-bg); font-weight: 600; font-size: 0.9em; }
.popup-content .cta-button {
    text-decoration: none; display: block;
    margin-left: auto; margin-right: auto;
}

/* ESTILOS DA LISTA DE LINKS */
.links-list-section {
    width: 100%; max-width: 900px; margin: 0 auto; /* Centraliza a seção */
}
.links-list-section h1 {
    font-size: 2.5em; margin-bottom: 30px; text-align: left;
    color: var(--text-light);
}

.link-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    padding: 25px;
    margin-bottom: 20px;
    display: flex; /* Alterado de grid para flex */
    flex-direction: column; /* Organiza o corpo e o rodapé em coluna */
    gap: 15px;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.link-card-body {
    display: flex;
    justify-content: space-between; /* Empurra o texto para a esquerda e os ícones para a direita */
    align-items: center; /* Alinha tudo verticalmente no centro */
    gap: 20px;
}

.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.link-card-main {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.link-card-title {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-light);
    margin: 0;
}
.link-card-shorturl {
    font-size: 1.05em;
    color: #00C4FF;
    text-decoration: none;
    word-break: break-all;
    font-weight: 500;
    transition: color 0.2s;
}
.link-card-shorturl:hover {
    color: #008DFF;
}
.link-card-longurl {
    font-size: 0.9em;
    color: var(--text-muted);
    word-break: break-all;
    margin-top: 5px;
}

.link-card-actions {
    grid-area: actions;
    display: flex;
    align-items: flex-start; /* Mantém os ícones alinhados no topo da sua caixinha */
    gap: 10px;
    flex-shrink: 0; /* Impede que os ícones encolham */
}

.icon-button {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
    color: var(--text-light); /* Cor padrão dos ícones */
}
.icon-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}
.icon-button svg {
    width: 20px; /* Tamanho dos ícones */
    height: 20px;
}

.icon-button {
    /* ... (outros estilos que já estão lá) ... */
    font-size: 18px; /* Controle o tamanho do ícone aqui */
}

/* Adicione esta nova regra para ajudar na centralização do ícone */
.icon-button i {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cores específicas para botões */
.icon-button.copy-button:hover { background-color: #2ecc71; color: white; }
.icon-button.edit-button:hover { background-color: #3498db; color: white; }
.icon-button.delete-button:hover { background-color: #e74c3c; color: white; }


.link-card-footer {
    font-size: 0.85em;
    color: var(--text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 15px;
    margin-top: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.link-card-footer span {
    display: flex;
    align-items: center;
    gap: 5px;
}
.link-card-footer svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}
.link-card-clicks {
    font-weight: 600;
    color: var(--text-light);
}
.link-card-clicks strong {
    font-size: 1.1em;
    color: #00C4FF;
}

/* MEDIA QUERIES PARA RESPONSIVIDADE */
@media (max-width: 768px) {
    .main-content {
        padding: 80px 20px 20px 20px; 
    }
    body.sidebar-collapsed .main-content {
        padding-left: 20px;
    }
    body:not(.sidebar-collapsed) .sidebar-toggle-button {
        transform: translateX(calc(var(--sidebar-width) - 40px));
    }
    .glass-container, .container {
        padding: 20px;
    }
    .links-list-section h1 {
        text-align: center;
    }
    .link-card-actions {
        justify-content: center; /* Centraliza os botões em telas menores */
    }
}

/* --- ANIMAÇÃO DAS LUZES DE FUNDO --- */
@keyframes move-light1 {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(80px, 150px);
  }
  100% {
    transform: translate(0, 0);
  }
}

@keyframes move-light2 {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-120px, -100px);
  }
  100% {
    transform: translate(0, 0);
  }
}

/* ================================== */
/* === ESTILOS DO POPUP DE QR CODE === */
/* ================================== */

.popup-content .popup-subtitle {
  font-size: 1em;
  font-weight: 500;
  color: var(--text-muted);
  text-align: left;
  margin-bottom: 15px;
}

.popup-content .input-group {
  display: flex;
  gap: 10px;
}

.popup-content .input-group input {
  flex-grow: 1; /* Faz o input ocupar o espaço disponível */
  width: 100%; 
  padding: 14px 18px; 
  border: 1px solid var(--glass-border);
  background-color: rgba(0, 0, 0, 0.2); 
  color: var(--text-light);
  border-radius: 10px; 
  font-size: 16px;
}
.popup-content .input-group input:focus {
  outline: none; 
  border-color: var(--primary-color); 
}


.popup-content .input-group button {
  flex-shrink: 0; /* Impede que o botão encolha */
  padding: 14px 25px;
  font-size: 16px;
  font-weight: 600;
}

.feedback-message {
    height: 18px;
    margin-top: 10px;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--button-copy-bg);
}

.popup-divider {
  border: none;
  height: 1px;
  background-color: var(--glass-border);
  margin: 30px 0;
}

.links-list-popup {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 10px;
  background-color: rgba(0,0,0,0.1);
}

.links-list-popup .link-item {
  padding: 12px 15px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
  text-align: left;
  word-break: break-all;
}

.links-list-popup .link-item:hover {
  background-color: var(--primary-color);
}

.links-list-popup .link-item-title {
  font-weight: 600;
  color: var(--text-light);
  display: block;
}

.links-list-popup .link-item-url {
  font-size: 0.85em;
  color: var(--text-muted);
}

#popup-qr-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

#qr-code-container {
  padding: 15px;
  background-color: white;
  border-radius: 8px;
  line-height: 0; /* Remove espaços extras */
}

.qr-code-url-text {
    font-weight: 500;
    color: var(--text-muted);
}
/* ======================================= */
/* === ESTILIZAÇÃO DA BARRA DE ROLAGEM === */
/* ======================================= */

/* Define a largura e o estilo geral da barra de rolagem */
.links-list-popup::-webkit-scrollbar {
  width: 8px; /* Uma largura mais fina e moderna */
}

/* O fundo (trilha) da barra de rolagem */
.links-list-popup::-webkit-scrollbar-track {
  background: transparent; /* Deixa a trilha invisível */
  margin: 5px 0; /* Adiciona um respiro no topo e na base */
}

/* A "bolinha" ou o controle que você arrasta */
.links-list-popup::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.2); /* Cor de vidro, semi-transparente */
  border-radius: 20px; /* Totalmente arredondado, formato de pílula */
  border: 2px solid transparent; /* Cria um efeito de preenchimento interno */
  background-clip: content-box; /* Garante que o fundo não passe por baixo da borda */
}

/* Efeito ao passar o mouse por cima da "bolinha" */
.links-list-popup::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.4); /* Fica um pouco mais visível */
}

/* ======================================= */
/* === ESTILOS DA LISTA DE QR CODES    === */
/* ======================================= */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}
.list-header h1 {
    margin: 0;
}
.list-header .cta-button {
    width: auto; /* Botão com largura automática */
}

.qr-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    align-items: center;
}
.qr-card-image {
    background-color: white;
    padding: 10px;
    border-radius: 8px;
    flex-shrink: 0; /* Impede que a imagem encolha */
}
.qr-card-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}
.qr-card-title {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-light);
    margin: 0;
}
.qr-card-url {
    font-size: 1em;
    color: #00C4FF;
    text-decoration: none;
    word-break: break-all;
}
.qr-card-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}
.action-button {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    font-size: 0.9em;
}
.action-button.download-button {
    background-color: #2ecc71;
    color: white;
}
.action-button.delete-button {
    background-color: #e74c3c;
    color: white;
}
/* Cor específica para o novo botão de QR Code */
.icon-button.qr-button:hover { 
    background-color: #00c49a; /* Um tom de verde "QR Code" */
    color: white; 
}
/* Estilos para o container do QR Code no novo popup */
#links-page-qr-container {
  padding: 15px;
  background-color: white;
  border-radius: 8px;
  line-height: 0; /* Impede bugs de alinhamento */
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Reutiliza o estilo do texto da URL que já definimos */
.qr-code-url-text {
  font-weight: 500;
  color: var(--text-muted);
  word-break: break-all;
  text-align: center;
}
/* =============================== */
/* === ESTILOS DA CHAVE SELETORA (COM ANIMAÇÃO) === */
/* =============================== */
.creation-toggle {
    display: flex;
    position: relative; /* Essencial para o pseudo-elemento */
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 5px; /* Espaço interno para o fundo deslizar */
    margin-bottom: 25px;
    border: 1px solid var(--glass-border);
    overflow: hidden; /* Garante que o fundo não 'vaze' pelas bordas arredondadas */
}

/* O fundo azul que desliza */
.creation-toggle::before {
    content: '';
    position: absolute;
    top: 5px; /* Alinha com o padding do container */
    left: 5px; /* Começa na posição do primeiro botão */
    height: calc(100% - 10px); /* Altura igual à área interna */
    width: calc(50% - 5px);   /* Metade da largura interna */
    background-color: var(--primary-color); /* A cor ativa */
    border-radius: 9px; /* Mesma borda dos botões */
    transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1); /* Transição suave */
    z-index: 0; /* Fica atrás dos botões */
}

/* Quando o container tiver a classe .qr-active, move o fundo */
.creation-toggle.qr-active::before {
    transform: translateX(100%); /* Desliza 100% da sua própria largura para a direita */
}

/* Estilo dos botões */
.toggle-option {
    position: relative; /* Para garantir que fiquem acima do ::before */
    z-index: 1;         /* Ficam na frente do fundo azul */
    flex: 1;
    padding: 12px 15px;
    border: none;
    background-color: transparent; /* Fundo transparente */
    color: var(--text-muted); /* Cor padrão (inativo) */
    font-size: 15px;
    font-weight: 600;
    border-radius: 9px;
    cursor: pointer;
    transition: color 0.3s ease; /* Transição suave APENAS da cor do texto */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.toggle-option svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    transition: stroke 0.3s ease; /* Anima a cor do ícone junto com o texto */
}

/* Cor do texto do botão ATIVO (quando NÃO está no modo QR) */
.creation-toggle:not(.qr-active) .toggle-option[data-type="link"] {
    color: white;
}
/* Cor do texto do botão ATIVO (quando ESTÁ no modo QR) */
.creation-toggle.qr-active .toggle-option[data-type="qr"] {
    color: white;
}

/* Remove o hover do botão que já está ativo */
.creation-toggle:not(.qr-active) .toggle-option[data-type="link"]:hover,
.creation-toggle.qr-active .toggle-option[data-type="qr"]:hover {
    color: white; /* Mantém branco */
    cursor: default;
}

/* Efeito hover sutil no botão INATIVO */
.toggle-option:hover {
     color: var(--text-light); /* Clareia um pouco */
}
.hidden {
    display: none !important;
}