/* -------------------------------------------------------------
   SISTEMA DE ESTILOS PREMIUM - ENCURTADOR DE URLS
   Aesthetics: Glassmorphism, Neon Glows & Space Dark Mode
------------------------------------------------------------- */

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

:root {
    --bg-main: #070a13;
    --bg-radial: radial-gradient(circle at center, #131a30 0%, #070a13 100%);
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.06);
    --card-border-hover: rgba(0, 242, 254, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    --accent-gradient: linear-gradient(135deg, #b06ab3 0%, #4568dc 100%);
    --error-gradient: linear-gradient(135deg, #ff0844 0%, #ffb199 100%);
    --success-gradient: linear-gradient(135deg, #093028 0%, #237a57 100%);
    --color-primary: #00f2fe;
    --color-purple: #8a2be2;
    --shadow-glow: 0 0 20px rgba(0, 242, 254, 0.35);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-main);
    background-image: var(--bg-radial);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Background Blobs Animados */
.bg-blobs {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: floatBlob 15s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #00f2fe;
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: #8a2be2;
    bottom: -200px;
    right: -100px;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: #ff007f;
    top: 40%;
    right: 15%;
    opacity: 0.08;
    animation-delay: -10s;
}

@keyframes floatBlob {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.2); }
}

/* Container Principal */
.app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    z-index: 1;
    position: relative;
    flex-grow: 1;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

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

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.logo-icon svg {
    width: 22px;
    height: 22px;
    fill: #070a13;
}

.logo-text {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 40%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Estilo do Usuário */
.user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 6px 16px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 30px;
    backdrop-filter: blur(10px);
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.btn-logout {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    color: #ef4444;
    transition: var(--transition-smooth);
    border-radius: 50%;
}

.btn-logout:hover {
    color: #f87171;
    transform: scale(1.1);
    background: rgba(239, 68, 68, 0.1);
}

/* Tela de Login & Setup */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    z-index: 1;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px;
    backdrop-filter: blur(15px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
}

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

/* Painel de Controle Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

@media(min-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 350px 1fr;
    }
}

/* Cards em Geral (Glassmorphism) */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(10px);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Estatísticas */
.stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 30px;
}

@media(min-width: 768px) {
    .stats-row {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    background: var(--color-primary);
    filter: blur(40px);
    opacity: 0.15;
    top: -20px;
    right: -20px;
    border-radius: 50%;
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-detail {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Formulário de Criação */
.form-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-title svg {
    width: 20px;
    height: 20px;
    fill: var(--color-primary);
}

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

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.input-icon svg {
    width: 18px;
    height: 18px;
}

.form-input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: var(--transition-smooth);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* Prefixo da URL Customizada */
.custom-url-group {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    transition: var(--transition-smooth);
    padding-left: 14px;
}

.custom-url-group:focus-within {
    border-color: var(--color-primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.1);
}

.url-prefix {
    font-size: 14px;
    color: var(--text-secondary);
    user-select: none;
    border-right: 1px solid var(--card-border);
    padding-right: 10px;
    margin-right: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.custom-url-group .form-input {
    border: none;
    background: transparent;
    padding-left: 0;
}

.custom-url-group .form-input:focus {
    box-shadow: none;
    background: transparent;
}

.url-preview {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    word-break: break-all;
}

.url-preview span {
    color: var(--color-primary);
}

/* Botões */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    color: #070a13;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

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

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

/* Seção de Links */
.links-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.links-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.links-title {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.links-title svg {
    width: 22px;
    height: 22px;
    fill: var(--color-primary);
}

.links-count {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.search-wrapper {
    position: relative;
    max-width: 300px;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition-smooth);
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    display: flex;
}

.search-icon svg {
    width: 16px;
    height: 16px;
}

/* Listagem de Links */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.link-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
    border-left: 3px solid var(--color-primary);
    transition: var(--transition-smooth);
}

.link-card:hover {
    transform: translateX(4px);
    border-color: #4facfe;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

@media(min-width: 768px) {
    .link-card {
        flex-direction: row;
        align-items: center;
    }
}

.link-info {
    flex-grow: 1;
    min-width: 0; /* Impede overflow de textos longos */
}

.short-url-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.short-url-text {
    font-size: 17px;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition-smooth);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.short-url-text:hover {
    color: #4facfe;
    text-decoration: underline;
}

.original-url-text {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    text-decoration: none;
}

.original-url-text:hover {
    color: var(--text-primary);
}

.link-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.clicks-badge {
    background: rgba(0, 242, 254, 0.1);
    color: var(--color-primary);
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.clicks-badge svg {
    width: 14px;
    height: 14px;
}

.date-badge {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Ações do Link */
.link-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-action {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-action:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-action.copy:hover {
    background: rgba(0, 242, 254, 0.1);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-action.qr:hover {
    background: rgba(138, 43, 226, 0.1);
    border-color: #8a2be2;
    color: #a855f7;
}

.btn-action.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #f87171;
}

.btn-action svg {
    width: 18px;
    height: 18px;
}

/* Modais (QR Code / Confirm) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 10, 19, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-main);
    border: 1px solid var(--card-border);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border-radius: 24px;
    width: 90%;
    max-width: 360px;
    padding: 30px;
    text-align: center;
    transform: scale(0.9);
    transition: var(--transition-smooth);
    position: relative;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: var(--transition-smooth);
    display: flex;
}

.modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.qr-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}

.qr-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 24px;
    word-break: break-all;
}

.qr-code-container {
    background: white;
    padding: 16px;
    border-radius: 16px;
    display: inline-block;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    margin-bottom: 24px;
}

.qr-code-container img {
    display: block;
    max-width: 200px;
    height: auto;
}

/* Toast Notifications (Toasts de alerta) */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 2000;
}

.toast {
    background: rgba(19, 26, 48, 0.95);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(50px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-icon {
    display: flex;
    flex-shrink: 0;
}

.toast-icon svg {
    width: 20px;
    height: 20px;
}

.toast.success {
    border-left: 3px solid #10b981;
}

.toast.success .toast-icon {
    color: #10b981;
}

.toast.error {
    border-left: 3px solid #ef4444;
}

.toast.error .toast-icon {
    color: #ef4444;
}

.toast.info {
    border-left: 3px solid var(--color-primary);
}

.toast.info .toast-icon {
    color: var(--color-primary);
}

/* Estados vazios e Carregando */
.loading-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 0;
    color: var(--text-secondary);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

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

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

.empty-icon {
    font-size: 40px;
    margin-bottom: 16px;
    color: var(--text-muted);
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    z-index: 1;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-smooth);
}

footer a:hover {
    color: var(--color-primary);
}

/* Sistema de Abas da Autenticação */
.auth-tabs {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 10px;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 12px;
    transition: var(--transition-smooth);
    border-bottom: 2px solid transparent;
    flex: 1;
    text-align: center;
}

.tab-btn.active {
    color: var(--text-primary);
    border-color: var(--color-primary);
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
}

.tab-content {
    display: none;
}

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

/* Resultado da Consulta de Cliques */
.result-box {
    margin-top: 20px;
    padding: 16px;
    background: rgba(0, 242, 254, 0.04);
    border: 1px dashed rgba(0, 242, 254, 0.2);
    border-radius: 12px;
    text-align: center;
    display: none;
    animation: fadeIn 0.3s ease;
}

.result-box.error {
    background: rgba(239, 68, 68, 0.04);
    border-color: rgba(239, 68, 68, 0.2);
}

.result-clicks {
    font-size: 32px;
    font-weight: 800;
    color: var(--color-primary);
    margin: 8px 0;
    text-shadow: var(--shadow-glow);
}

.result-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.result-link {
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-all;
}

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