* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    border-radius: 0 0 20px 20px;
    margin-bottom: 2rem;
}

.logo {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1rem;
    color: #666;
}

/* Main Styles */
.main {
    padding: 2rem 0;
}

/* Search Section */
.search-section {
    text-align: center;
    margin-bottom: 3rem;
}

.search-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    flex-wrap: wrap;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 300px;
}

.search-input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 1rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Categories */
.categories {
    display: grid;
    gap: 2rem;
    margin-bottom: 3rem;
}

.category {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.category:hover {
    transform: translateY(-5px);
}

.category-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Links Grid */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.link-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    padding: 1.2rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.link-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.link-card:hover::before {
    opacity: 0.1;
}

.link-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.link-card h3 {
    font-size: 1rem;
    margin-bottom: 0.4rem;
    position: relative;
    z-index: 1;
}

.link-card p {
    font-size: 0.8rem;
    color: #666;
    position: relative;
    z-index: 1;
}

.link-icon {
    font-size: 1.5rem;
    margin-bottom: 0.8rem;
    position: relative;
    z-index: 1;
}

/* Admin Section */
.admin-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.admin-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #333;
}

.port-manager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.port-input {
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    transition: border-color 0.3s ease;
}

.port-input:focus {
    outline: none;
    border-color: #667eea;
}

.port-btn {
    padding: 0.8rem 2rem;
    font-size: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.port-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.port-message {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    display: none;
}

.port-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.port-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Service Status Styles */
.service-check-btn {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.service-check-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(40, 167, 69, 0.3);
}

.service-status {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: none;
}

.service-status.active {
    display: block;
}

.service-status h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.2rem;
}

.services-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.service-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    border-left: 4px solid #6c757d;
}

.service-item.online {
    border-left-color: #28a745;
}

.service-item.offline {
    border-left-color: #dc3545;
}

.service-item.error {
    border-left-color: #ffc107;
}

.service-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.service-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #6c757d;
}

.service-item.online .service-status-indicator {
    background: #28a745;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.5);
}

.service-item.offline .service-status-indicator {
    background: #dc3545;
}

.service-item.error .service-status-indicator {
    background: #ffc107;
}

.service-status-text {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    background: #f8f9fa;
}

.service-item.online .service-status-text {
    background: #d4edda;
    color: #155724;
}

.service-item.offline .service-status-text {
    background: #f8d7da;
    color: #721c24;
}

.service-item.error .service-status-text {
    background: #fff3cd;
    color: #856404;
}

.status-summary {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.online-badge {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.offline-badge {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.error-badge {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.error-message {
    text-align: center;
    padding: 1rem;
    background: #f8d7da;
    color: #721c24;
    border-radius: 10px;
    border: 1px solid #f5c6cb;
}

/* STUN URL Styles */
.stun-urls {
    display: grid;
    gap: 2rem;
}

.stun-group {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    padding: 1.5rem;
    border-left: 4px solid #667eea;
}

.stun-group h4 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stun-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.stun-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.stun-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.stun-name {
    font-weight: 600;
    color: #333;
    min-width: 120px;
}

.stun-url {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #495057;
    background: #f8f9fa;
    padding: 0.3rem 0.5rem;
    border-radius: 5px;
    margin: 0 1rem;
}

.port {
    color: #667eea;
    font-weight: bold;
}

.copy-btn {
    padding: 0.25rem 0.6rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.copy-btn:active {
    transform: translateY(0);
}

/* Enhanced Port Manager Styles */
.port-controls {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

.port-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.port-input-group label {
    font-weight: 600;
    color: #333;
}

.port-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.refresh-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

/* Webhook Info Styles */
.webhook-info {
    margin-top: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 15px;
    border-left: 4px solid #2196f3;
}

.webhook-info h3 {
    margin-bottom: 1rem;
    color: #1976d2;
}

.webhook-endpoint {
    margin-bottom: 1.5rem;
}

.webhook-endpoint label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.endpoint-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid #90caf9;
}

.endpoint-display code {
    flex: 1;
    font-family: 'Courier New', monospace;
    color: #1976d2;
    font-size: 0.9rem;
}

.webhook-payload label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.code-block {
    background: #263238;
    color: #aed581;
    padding: 1rem;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    white-space: pre;
}

/* Responsive Design for STUN URLs */
@media (max-width: 768px) {
    .stun-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .stun-name {
        min-width: auto;
        text-align: center;
    }
    
    .stun-url {
        margin: 0;
        text-align: center;
    }
    
    .copy-btn {
        align-self: center;
    }
    
    .port-actions {
        flex-direction: column;
    }
    
    .endpoint-display {
        flex-direction: column;
        text-align: center;
    }
    
    .code-block {
        font-size: 0.8rem;
    }
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem 0;
    text-align: center;
    margin-top: 3rem;
    border-radius: 20px 20px 0 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .links-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 0.8rem;
    }
    
    .link-card {
        padding: 0.8rem;
    }
    
    .link-icon {
        font-size: 1.2rem;
        margin-bottom: 0.6rem;
    }
    
    .link-card h3 {
        font-size: 0.9rem;
        margin-bottom: 0.3rem;
    }
    
    .link-card p {
        font-size: 0.7rem;
    }
    
    .category {
        padding: 1.2rem;
    }
    
    .category-title {
        font-size: 1.3rem;
    }
    
    .stun-group {
        padding: 1rem;
    }
    
    .stun-group h4 {
        font-size: 1rem;
    }
    
    .stun-item {
        padding: 0.8rem;
    }
    
    .stun-name {
        font-size: 0.9rem;
    }
    
    .stun-url {
        font-size: 0.8rem;
    }
    
    .copy-btn {
        padding: 0.2rem 0.6rem;
        font-size: 0.7rem;
    }
    
    .port-manager {
        flex-direction: column;
        align-items: stretch;
    }
    
    .port-input,
    .port-btn {
        width: 100%;
    }
    
    .search-input {
        padding: 0.8rem 2.5rem 0.8rem 0.8rem;
        font-size: 1rem;
    }
}

/* Animation for loading */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category {
    animation: fadeIn 0.6s ease-out;
}

.category:nth-child(2) {
    animation-delay: 0.1s;
}

.category:nth-child(3) {
    animation-delay: 0.2s;
}

.category:nth-child(4) {
    animation-delay: 0.3s;
}

/* Hide links that don't match search */
.link-card.hidden {
    display: none;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
    
    .header,
    .category,
    .admin-section,
    .footer {
        background: rgba(30, 30, 30, 0.95);
        color: #f0f0f0;
    }
    
    .logo {
        background: linear-gradient(45deg, #667eea, #764ba2);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .subtitle {
        color: #aaa;
    }
    
    .search-input,
    .port-input {
        background: rgba(50, 50, 50, 0.9);
        color: #f0f0f0;
        border-color: #555;
    }
    
    .link-card {
        background: linear-gradient(135deg, #2a2a3e 0%, #1e1e2e 100%);
        color: #f0f0f0;
    }
    
    .link-card p {
        color: #aaa;
    }
    
    .category-title {
        color: #f0f0f0;
    }
}