/* Reset và Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a73e8;
    --primary-hover: #1557b0;
    --success-color: #34a853;
    --error-color: #ea4335;
    --warning-color: #fbbc04;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --border-color: #dadce0;
    --bg-white: #ffffff;
    --bg-gray: #f8f9fa;
    --shadow: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
    --shadow-hover: 0 1px 3px 0 rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
    --border-radius: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Roboto', 'Segoe UI', 'Arial', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-gray);
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: var(--bg-white);
    box-shadow: var(--shadow);
    padding: 16px 0;
    margin-bottom: 40px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: 500;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 28px;
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    padding: 20px 0 60px;
}

/* Card */
.card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 32px;
    margin-bottom: 24px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-title {
    font-size: 24px;
    font-weight: 400;
    margin-bottom: 24px;
    color: var(--text-primary);
}

/* Form Styles */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.form-input::placeholder {
    color: var(--text-secondary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #2d8e47;
    box-shadow: var(--shadow);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-gray);
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

/* Result Box */
.result-box {
    background: #e8f0fe;
    border: 1px solid #d2e3fc;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 24px;
}

.result-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.result-url {
    display: flex;
    gap: 12px;
    align-items: center;
}

.result-url input {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius);
    background: white;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.stat-value {
    font-size: 36px;
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--bg-gray);
}

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

tr:last-child td {
    border-bottom: none;
}

.link-cell {
    color: var(--primary-color);
    text-decoration: none;
    word-break: break-all;
}

.link-cell:hover {
    text-decoration: underline;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-primary {
    background: #e8f0fe;
    color: var(--primary-color);
}

.badge-success {
    background: #e6f4ea;
    color: var(--success-color);
}

/* Alert */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: #e6f4ea;
    color: #137333;
    border: 1px solid #c6e1c6;
}

.alert-error {
    background: #fce8e6;
    color: #c5221f;
    border: 1px solid #f6aea9;
}

.alert-info {
    background: #e8f0fe;
    color: #174ea6;
    border: 1px solid #aecbfa;
}

.alert-warning {
    background: #fef7e0;
    color: #ea8600;
    border: 1px solid #fdc935;
}

/* Loading Spinner */
.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Redirect Page Styles */
.redirect-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.redirect-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    padding: 48px;
    max-width: 600px;
    width: 100%;
    text-align: center;
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
}

.step {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-gray);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    transition: var(--transition);
}

.step.active {
    background: var(--primary-color);
    color: white;
}

.step.completed {
    background: var(--success-color);
    color: white;
}

/* Countdown Timer */
.countdown-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 32px auto;
}

.countdown-circle {
    width: 200px;
    height: 200px;
    transform: rotate(-90deg);
    position: absolute;
    top: 0;
    left: 0;
}

.countdown-circle circle {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
}

.countdown-bg {
    stroke: var(--bg-gray);
}

.countdown-progress {
    stroke: var(--primary-color);
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.countdown-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 72px;
    font-weight: 500;
    color: var(--primary-color);
    transition: color 0.3s ease;
    z-index: 1;
    /* Ensure the number is always centered */
    line-height: 1;
    margin: 0;
    padding: 0;
}

/* No animation to prevent position shifting */

.countdown-label {
    font-size: 18px;
    color: var(--text-secondary);
    margin-top: 16px;
}

/* Captcha */
.captcha-container {
    background: var(--bg-gray);
    border-radius: var(--border-radius);
    padding: 24px;
    margin: 24px 0;
}

.captcha-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.captcha-box {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.captcha-image {
    background: white;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 32px;
    font-weight: bold;
    letter-spacing: 8px;
    color: var(--primary-color);
    user-select: none;
    font-family: 'Courier New', monospace;
}

.captcha-refresh {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.captcha-refresh:hover {
    background: var(--bg-gray);
    transform: rotate(180deg);
    border-color: var(--primary-color);
}

/* Link Info */
.link-info {
    background: var(--bg-gray);
    border-radius: var(--border-radius);
    padding: 24px;
    margin: 24px 0;
    text-align: left;
}

.link-info-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.link-info-url {
    font-size: 14px;
    color: var(--text-secondary);
    word-break: break-all;
}

/* Password Protection */
.password-container {
    margin: 24px 0;
}

/* Ad Container */
.ad-container {
    margin: 24px 0;
    text-align: center;
}

/* Footer */
.footer {
    background: var(--bg-white);
    padding: 24px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    border-top: 1px solid var(--border-color);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.tab:hover {
    color: var(--primary-color);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 20px;
    }
    
    .redirect-card {
        padding: 32px 20px;
    }
    
    .countdown-container {
        width: 150px;
        height: 150px;
    }
    
    .countdown-circle {
        width: 150px;
        height: 150px;
    }
    
    .countdown-number {
        font-size: 56px;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Copy Animation */
@keyframes copySuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.copy-success {
    animation: copySuccess 0.3s ease-out;
}
