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

/* Variables for Dark Theme */
:root {
    --bg-color: #0b0f19;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --primary-color: #6366f1;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --primary-hover: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    --input-bg: rgba(15, 23, 42, 0.6);
    --input-border: rgba(255, 255, 255, 0.1);
    --success-color: #10b981;
    --error-color: #ef4444;
}

/* Reset và Styles cơ bản */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-primary);
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Aurora Background Animation */
.background-aurora {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background-color: var(--bg-color);
}

.blob {
    position: absolute;
    filter: blur(90px);
    opacity: 0.6;
    border-radius: 50%;
    animation: drift 20s infinite alternate cubic-bezier(0.5, 0, 0.5, 1);
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background-color: rgba(99, 102, 241, 0.4); /* Indigo */
    animation-duration: 25s;
}

.blob-2 {
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background-color: rgba(168, 85, 247, 0.3); /* Purple */
    animation-duration: 28s;
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 60%;
    width: 40vw;
    height: 40vw;
    background-color: rgba(14, 165, 233, 0.3); /* Sky Blue */
    animation-duration: 22s;
    animation-delay: -10s;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10vw, 15vh) scale(1.1); }
}

/* Container Glassmorphism */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: clamp(30px, 5vw, 50px);
    width: 100%;
    max-width: 600px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    position: relative;
    z-index: 10;
    margin-bottom: auto;
    margin-top: auto;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
}

.glass-panel:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6);
}

h1 {
    margin-bottom: 30px;
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 2.75rem);
    background: linear-gradient(to right, #ffffff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

/* Form Styles */
form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

input[type="url"],
input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.05rem;
    font-family: 'Inter', sans-serif;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

input[type="url"]::placeholder,
input[type="text"]::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

input[type="url"]:focus,
input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--primary-color);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2), inset 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

/* Fix browser autofill white background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px rgba(15, 23, 42, 0.9) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    caret-color: var(--text-primary);
}

/* Turnstile Wrapper */
.cf-turnstile-wrapper {
    display: flex;
    justify-content: center;
    margin: 5px 0;
    min-height: 65px;
}

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

button {
    padding: 16px 24px;
    font-size: 1.05rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

#submit-button {
    flex-grow: 1;
    box-shadow: 0 10px 20px -10px var(--primary-color);
}

button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

button:hover::after {
    left: 100%;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: 0 15px 25px -10px var(--primary-color);
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    background: #334155;
    color: #94a3b8;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loader */
.loader {
    border: 3px solid rgba(255,255,255,0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.hidden {
    display: none !important;
}

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

/* Result Section */
#result {
    margin-top: 35px;
    padding: 25px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#result.visible {
    opacity: 1;
    transform: translateY(0);
}

#result p {
    margin-bottom: 20px;
    font-size: 1.05rem;
    color: var(--text-primary);
    word-break: break-all;
}

#result p a {
    color: #818cf8;
    text-decoration: none;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.1);
    transition: all 0.2s ease;
}

#result p a:hover {
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.2);
}

#edit-url {
    margin-bottom: 20px;
}

.result-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.action-btn {
    padding: 12px;
    font-size: 0.95rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn:hover {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.action-btn i {
    font-size: 1.1rem;
    color: #818cf8;
}

/* Toastify Customization */
.toastify {
    border-radius: 10px !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 500 !important;
    padding: 12px 24px !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3) !important;
}

/* QR Code */
#qr-code {
    margin: 0 auto;
    display: block;
    border-radius: 12px;
    padding: 10px;
    background: #fff;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

#qr-code:hover {
    transform: scale(1.05);
}

/* Footer Section */
.footer {
    margin-top: 40px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    z-index: 10;
}

.footer a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

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

.stats {
    margin-top: 15px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
}

.stats i {
    color: #10b981;
}

.stats-number {
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .glass-panel {
        padding: 25px 20px;
        border-radius: 20px;
    }
    
    .result-actions {
        grid-template-columns: 1fr;
    }
    
    h1 {
        font-size: 1.75rem;
    }
}
/* Additional Button Styles */
.btn-primary {
    background: var(--primary-gradient);
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Input Group with Icon (used in s-manager) */
.input-group {
    position: relative;
    width: 100%;
}

.input-group .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
}

.input-group input {
    padding-left: 44px !important;
    width: 100%;
}

/* Subtitle */
.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
    margin-bottom: 0;
}

/* Header section in admin */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    margin-bottom: 8px;
}

/* Admin Topbar */
.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--glass-border);
}

.admin-topbar-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.admin-topbar-title i {
    font-size: 2rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    flex-shrink: 0;
}

.admin-topbar-title h1 {
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    margin-bottom: 2px;
    background: linear-gradient(to right, #ffffff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

#topbar-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Manager panel width override */
.manager-panel {
    max-width: 1200px;
    width: 95%;
    margin: 30px auto;
    text-align: left; /* Override glass-panel text-align: center */
}

/* Login section - center content for login form */
#login-section {
    max-width: 480px;
    margin: 0 auto;
    padding: 10px 0;
}

#login-section form {
    width: 100%;
}

#login-section .input-group,
#login-section input,
#login-section button {
    width: 100%;
    box-sizing: border-box;
}

/* Visitor count badge */
.visitor-count {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Pagination */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.page-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(30, 41, 59, 0.6);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    letter-spacing: 0;
    text-transform: none;
}

.page-btn:hover:not(.disabled):not(.active) {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary-color);
    color: #a5b4fc;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.page-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.page-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}
