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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

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

header h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    color: white;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
}

.btn-secondary {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Performance Alert */
.performance-alert {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
    animation: slideInAlert 0.5s ease, pulseAlert 2s infinite;
}

.performance-alert.warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    box-shadow: 0 8px 25px rgba(243, 156, 18, 0.3);
}

.performance-alert.critical {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
}

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

@keyframes pulseAlert {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
    }
    50% {
        box-shadow: 0 8px 35px rgba(255, 107, 107, 0.5);
    }
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
}

.alert-content i {
    font-size: 2rem;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

.alert-text {
    flex: 1;
}

.alert-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.alert-description {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 500;
}

.alert-percentage {
    font-size: 2.5rem;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    min-width: 80px;
    text-align: center;
}

/* Redirect Chain Styling */
.redirect-chain-details {
    margin-top: 8px;
    padding: 10px;
    background: rgba(0,0,0,0.05);
    border-radius: 6px;
    font-size: 0.85rem;
    border-left: 4px solid #3498db;
    line-height: 1.4;
}

.redirect-chain-details strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.chain-step {
    padding: 3px 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    align-items: center;
}

.chain-step.blocked {
    color: #e74c3c;
    font-weight: 600;
}

.chain-step.clean {
    color: #27ae60;
}

.chain-step.unknown {
    color: #f39c12;
}

.chain-summary {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.1);
    font-weight: 600;
    font-size: 0.9rem;
}

.chain-summary.has-blocked {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    padding: 5px 8px;
    border-radius: 4px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #3498db;
    margin-bottom: 5px;
}

.stat-label {
    color: #7f8c8d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.site-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.site-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: #bdc3c7;
    transition: all 0.3s ease;
}

.site-card.online::before {
    background: linear-gradient(90deg, #27ae60, #2ecc71);
}

.site-card.offline::before {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.site-card.blocked::before {
    background: linear-gradient(90deg, #f39c12, #e67e22);
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.site-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: #2c3e50;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #bdc3c7;
    animation: pulse 2s infinite;
    position: relative;
}

.status-indicator.online {
    background: #27ae60;
    box-shadow: 0 0 10px rgba(39, 174, 96, 0.5);
}

.status-indicator.offline {
    background: #e74c3c;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

.status-indicator.blocked {
    background: #f39c12;
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
}

.status-indicator.checking {
    background: #3498db;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.site-url {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 15px;
    word-break: break-all;
}

.site-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.metric {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.metric-value.fast {
    color: #27ae60;
}

.metric-value.slow {
    color: #e74c3c;
}

.metric-value.medium {
    color: #f39c12;
}

.metric-label {
    font-size: 0.8rem;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nawala-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.nawala-status.not-blocked {
    background: #d5f4e6;
    color: #27ae60;
}

.nawala-status.blocked {
    background: #ffeaa7;
    color: #e17055;
}

.nawala-status.error {
    background: #fab1a0;
    color: #e74c3c;
}

.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
}

.loading.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading p {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Login Modal Styles */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(10px);
}

.login-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>') repeat;
    pointer-events: none;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 50px 40px;
    border-radius: 25px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.2);
    text-align: center;
    max-width: 420px;
    width: 90%;
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

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

.login-header h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 2.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.login-header h2 i {
    background: linear-gradient(45deg, #3498db, #2980b9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.login-header p {
    color: #5a6c7d;
    margin-bottom: 35px;
    font-size: 1.1rem;
    font-weight: 400;
    opacity: 0.8;
    position: relative;
    z-index: 1;
}

.input-group {
    position: relative;
    margin-bottom: 25px;
    z-index: 1;
}

.input-group i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #3498db;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    z-index: 2;
}

.input-group input {
    width: 100%;
    padding: 18px 18px 18px 50px;
    border: 2px solid rgba(52, 152, 219, 0.2);
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.input-group input:focus {
    outline: none;
    border-color: #3498db;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.15), 0 0 0 3px rgba(52, 152, 219, 0.1);
    transform: translateY(-2px);
}

.input-group input:focus + i,
.input-group:focus-within i {
    color: #2980b9;
    transform: translateY(-50%) scale(1.1);
}

.login-btn {
    width: 100%;
    padding: 18px 20px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 50%, #1abc9c 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.3);
    z-index: 1;
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 35px rgba(52, 152, 219, 0.4), 0 0 0 3px rgba(52, 152, 219, 0.1);
    background: linear-gradient(135deg, #2980b9 0%, #3498db 50%, #16a085 100%);
}

.login-btn:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}

.login-error {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    color: #c62828;
    padding: 15px 20px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    animation: shake 0.6s ease, fadeInError 0.4s ease;
    border: 2px solid rgba(198, 40, 40, 0.2);
    box-shadow: 0 4px 15px rgba(198, 40, 40, 0.1);
    position: relative;
    overflow: hidden;
}

.login-error::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #e74c3c, #c0392b, #e74c3c);
    animation: errorPulse 2s infinite;
}

@keyframes errorPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-3px); }
    20%, 40%, 60%, 80% { transform: translateX(3px); }
}

.logout-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 50%, #a93226 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
    position: relative;
    overflow: hidden;
}

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

.logout-btn:hover::before {
    left: 100%;
}

.logout-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4), 0 0 0 2px rgba(231, 76, 60, 0.2);
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 50%, #922b21 100%);
}

.logout-btn:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .sites-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .site-metrics {
        grid-template-columns: 1fr 1fr;
    }

    .controls {
        flex-direction: column;
        gap: 10px;
    }

    .controls button {
        width: 100%;
    }

    h1 {
        font-size: 1.8rem;
    }

    .stat-card h3 {
        font-size: 1.5rem;
    }

    /* Login Modal Mobile */
    .login-container {
        padding: 35px 25px;
        margin: 15px;
        max-width: 95%;
        border-radius: 20px;
    }

    .login-header h2 {
        font-size: 1.8rem;
        gap: 8px;
    }

    .login-header h2 i {
        font-size: 1.6rem;
    }

    .login-header p {
        font-size: 1rem;
        margin-bottom: 30px;
    }

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

    .input-group input {
        padding: 16px 16px 16px 45px;
        font-size: 1rem;
        border-radius: 12px;
    }

    .input-group i {
        left: 15px;
        font-size: 1.1rem;
    }

    .login-btn {
        padding: 16px 18px;
        font-size: 1.1rem;
        border-radius: 12px;
        margin-bottom: 18px;
    }

    .login-error {
        padding: 12px 16px;
        font-size: 0.9rem;
        border-radius: 10px;
    }

    .logout-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
        border-radius: 20px;
        letter-spacing: 0.3px;
    }

    header div {
        flex-direction: column;
        gap: 20px;
        text-align: center;
        align-items: center;
    }

    header div > div:first-child {
        order: 1;
    }

    .logout-btn {
        order: 2;
        align-self: center;
    }

    /* Performance Alert Mobile */
    .performance-alert {
        padding: 15px;
        margin-bottom: 20px;
        border-radius: 12px;
    }

    .alert-content {
        gap: 12px;
    }

    .alert-content i {
        font-size: 1.5rem;
    }

    .alert-title {
        font-size: 1.1rem;
    }

    .alert-description {
        font-size: 0.9rem;
    }

    .alert-percentage {
        font-size: 2rem;
        min-width: 60px;
    }

    /* Redirect Chain Styling */
    .redirect-chain-details {
        margin-top: 8px;
        padding: 8px;
        background: rgba(0,0,0,0.1);
        border-radius: 4px;
        font-size: 0.8rem;
        border-left: 3px solid #3498db;
    }

    .redirect-chain-details strong {
        color: #2c3e50;
        display: block;
        margin-bottom: 5px;
    }

    .chain-step {
        padding: 2px 0;
        font-family: 'Courier New', monospace;
    }

    .chain-step.blocked {
        color: #e74c3c;
        font-weight: bold;
    }

    .chain-step.clean {
        color: #27ae60;
    }

    .chain-step.unknown {
        color: #f39c12;
    }

    .chain-summary {
        margin-top: 5px;
        padding-top: 5px;
        border-top: 1px solid rgba(0,0,0,0.1);
        font-weight: bold;
    }

    .chain-summary.has-blocked {
        color: #e74c3c;
    }

    /* Mobile specific animations */
    .login-btn:hover {
        transform: translateY(-2px) scale(1.01);
    }

    .logout-btn:hover {
        transform: translateY(-1px) scale(1.03);
    }
}

@media (max-width: 480px) {
    .stats {
        grid-template-columns: 1fr;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .site-card {
        padding: 20px;
    }
}