:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --dark-bg: #2d3436;
    --darker-bg: #1e272e;
    --light-text: #dfe6e9;
    --success-color: #00b894;
    --danger-color: #ff6b6b;
}

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

body {
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--light-text);
    position: relative;
    overflow-x: hidden;
}

/* Enhanced anchor tag styles */
a {
    color: #74b9ff;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

a:hover {
    color: #a0e7ff;
    text-decoration: underline;
    text-decoration-color: rgba(116, 185, 255, 0.5);
    text-underline-offset: 3px;
    transform: translateY(-1px);
}

a:active {
    color: #4834d4;
    transform: translateY(0);
}

a:visited {
    color: #a29bfe;
}

/* For external links */
a[target="_blank"]::after {
    content: ' ↗';
    font-size: 0.8em;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

a[target="_blank"]:hover::after {
    opacity: 1;
}

/* For links inside cards/boxes */
.card a,
.proxy-meta a {
    color: #fd79a8;
}

.card a:hover,
.proxy-meta a:hover {
    color: #fdcb6e;
}

/* For buttons that are links */
.btn-link {
    color: var(--secondary-color) !important;
    background: transparent;
    border: 1px solid var(--secondary-color);
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    display: inline-block;
    transition: all 0.3s ease;
}

.btn-link:hover {
    color: var(--light-text) !important;
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(162, 155, 254, 0.3);
}

/* For export/clear buttons */
.export-btn,
.clear-btn {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    border: none;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.export-btn:hover,
.clear-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 184, 148, 0.4);
    color: white;
    text-decoration: none;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%23ffffff" fill-opacity="0.1" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,154.7C960,171,1056,181,1152,165.3C1248,149,1344,107,1392,85.3L1440,64L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
    z-index: -1;
    animation: wave 20s linear infinite;
}

@keyframes wave {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.main-container {
    padding: 2rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease;
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #fff, #a29bfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.control-panel {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    animation: fadeInUp 0.8s ease;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.form-select, .btn-primary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--light-text);
    transition: all 0.3s ease;
}

.form-select:focus, .btn-primary:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 0.2rem rgba(162, 155, 254, 0.25);
    color: var(--light-text);
}

.form-select option {
    background: var(--dark-bg);
    color: var(--light-text);
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border: none;
    padding: 0.75rem 2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(108, 92, 231, 0.4);
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color));
}

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

.loading-spinner {
    display: none;
    text-align: center;
    padding: 2rem;
}

.loading-spinner.show {
    display: block;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.proxy-list {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    animation: fadeIn 0.8s ease;
    max-height: 600px;
    overflow-y: auto;
}

.proxy-list::-webkit-scrollbar {
    width: 8px;
}

.proxy-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.proxy-list::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 10px;
}

.proxy-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.proxy-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.proxy-item:hover .proxy-address {
    color: #FFED4E;
    text-shadow: 0 0 6px rgba(255, 237, 78, 0.5);
}

.proxy-item.copy-success {
    background: rgba(0, 184, 148, 0.2);
    border-color: var(--success-color);
}

.proxy-address {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 1.15rem;
    font-weight: 700;
    color: #FFD700;
    margin-bottom: 0.25rem;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.7);
    letter-spacing: 0.5px;
}

.proxy-meta {
    font-size: 0.85rem;
    opacity: 0.7;
}

.protocol-badge {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(30, 30, 30, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
}

.copy-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--light-text);
    padding: 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--secondary-color);
}

.stats-bar {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.7;
}

.alert {
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid var(--danger-color);
    color: var(--light-text);
    border-radius: 10px;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: var(--dark-bg);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .control-panel {
        padding: 1.5rem;
    }

    .proxy-list {
        padding: 1rem;
        max-height: 500px;
    }

    .proxy-item {
        padding: 0.75rem;
    }

    .copy-btn {
        position: static;
        transform: none;
        margin-top: 0.5rem;
        width: 100%;
    }

    .stats-bar {
        gap: 1rem;
    }
}

/* Additional animations */
.proxy-item {
    animation: slideInLeft 0.5s ease forwards;
    opacity: 0;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Button click effect */
.btn-primary:active {
    transform: scale(0.98) translateY(0);
}

/* Filter animation */
#countryGroup {
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Scroll to top button */
#scrollTopBtn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--light-text);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

#scrollTopBtn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
}

#scrollTopBtn.show {
    display: flex;
}

/* Dark mode toggle (optional) */
#darkModeToggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--light-text);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

#darkModeToggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

/* Pulse animation for button */
.btn-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(162, 155, 254, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(162, 155, 254, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(162, 155, 254, 0);
    }
}

/* Pagination styles */
.pagination {
    margin-bottom: 0;
}

.pagination .page-link {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--light-text);
    padding: 0.5rem 1rem;
    margin: 0 0.125rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--secondary-color);
    color: var(--light-text);
    transform: translateY(-2px);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-color: transparent;
    color: white;
}

.pagination .page-item.disabled .page-link {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
}

/* Loading skeleton animation */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Performance optimization */
.proxy-item {
    will-change: transform;
    contain: layout style paint;
}

/* Smooth transitions for page changes */
#proxyListContainer {
    transition: opacity 0.3s ease;
}

#proxyListContainer.loading {
    opacity: 0.5;
}