:root {
    --bg-main: #0a0a0a;
    --bg-surface: #1a1a1a;
    --bg-surface-hover: #252525;
    --border-color: #333333;
    --border-hover: #4a4a4a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-primary: #3b82f6;
    --accent-secondary: #1d4ed8;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --font-family: 'Inter', sans-serif;
    --font-mono: 'Fira Code', 'Source Code Pro', monospace;
    --risk-color-critical: #ef4444;
    --risk-color-high: #f97316;
    --risk-color-medium: #3b82f6;
    --risk-color-good: #22c55e;
    --risk-color-dobre: #22c55e;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(29, 78, 216, 0.1) 0%, transparent 50%);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 0;
    text-align: center;
}

.app-header {
    margin-bottom: 60px;
    animation: fadeInUp 0.8s ease-out;
}

.app-header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.app-header .subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
}

.input-section {
    margin-bottom: 50px;
    animation: fadeInUp 0.8s ease-out 0.1s both;
}

.url-input-wrapper {
    display: flex;
    align-items: center;
    max-width: 700px;
    margin: auto;
    background: var(--bg-surface);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 8px 12px 8px 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.url-input-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    transition: left 0.5s;
}

.url-input-wrapper:hover::before {
    left: 100%;
}

.url-input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1), var(--shadow-lg);
    transform: translateY(-2px);
}

.url-prefix {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-right: 8px;
}

#url-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    padding: 16px 12px;
    font-weight: 500;
}

#url-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.error-message {
    color: var(--error-color);
    min-height: 24px;
    margin-top: 16px;
    font-weight: 500;
    animation: shake 0.5s ease-in-out;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.tool-card {
    background: var(--bg-surface);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 24px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.tool-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-xl);
    background: var(--bg-surface-hover);
}

.tool-card:hover::before {
    opacity: 0.05;
}

.tool-card.tool-card-large {
    grid-column: span 2;
}

.card-icon {
    font-size: 2.2rem;
    line-height: 1;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon svg {
    transition: all 0.3s ease;
}

.tool-card:hover .card-icon {
    transform: scale(1.1);
}

.tool-card:hover .card-icon svg {
    filter: drop-shadow(0 4px 8px rgba(59, 130, 246, 0.3));
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.card-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
    line-height: 1.3;
    text-align: center;
}

.loader-wrapper,
.results-section,
.webhook-info-container {
    margin-top: 50px;
    animation: fadeInUp 0.6s ease-out;
}

.results-section {
    display: none;
    background: var(--bg-surface);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    text-align: left;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

#results-title {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    margin-bottom: 30px;
    padding: 16px 20px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 12px;
    border-left: 4px solid var(--accent-primary);
}

.summary-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.results-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
}

.results-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
}

.results-table th,
.results-table td {
    padding: 18px 20px;
    text-align: left;
    vertical-align: middle;
}

.results-table thead th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    background: rgba(0, 0, 0, 0.3);
}

.results-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.results-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

.results-table tbody tr:last-child {
    border-bottom: none;
}

.results-table td:first-child {
    border-left: 4px solid transparent;
    font-weight: 500;
}

.results-table tr.risk-krytyczne td:first-child { border-left-color: var(--risk-color-critical); }
.results-table tr.risk-wysokie td:first-child { border-left-color: var(--risk-color-high); }
.results-table tr.risk-srednie td:first-child { border-left-color: var(--risk-color-medium); }
.results-table tr.risk-dobre td:first-child { border-left-color: var(--risk-color-dobre); }

.results-table tr.risk-krytyczne td:nth-child(3) { color: var(--risk-color-critical); font-weight: 600; }
.results-table tr.risk-wysokie td:nth-child(3) { color: var(--risk-color-high); font-weight: 600; }
.results-table tr.risk-srednie td:nth-child(3) { color: var(--risk-color-medium); font-weight: 600; }
.results-table tr.risk-dobre td:nth-child(3) { color: var(--risk-color-dobre); font-weight: 600; }

.recommendation-cell {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.webhook-info-container {
    background: var(--bg-surface);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.webhook-info-container h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
}

.webhook-url-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
}

input.webhook-url {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

#copy-webhook-url {
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#copy-webhook-url:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.webhook-console {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.console-placeholder {
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
}

.log-entry {
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    border-left: 3px solid var(--accent-primary);
    animation: slideInRight 0.3s ease-out;
}

.log-entry:first-child {
    margin-top: 0;
}

.log-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.log-line:last-child {
    margin-bottom: 0;
}

.log-method { 
    font-weight: bold; 
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.log-method-get { 
    background: rgba(59, 130, 246, 0.2); 
    color: #60a5fa; 
}

.log-method-post { 
    background: rgba(34, 197, 94, 0.2); 
    color: #4ade80; 
}

.log-method-put { 
    background: rgba(249, 115, 22, 0.2); 
    color: #fb923c; 
}

.log-method-delete { 
    background: rgba(239, 68, 68, 0.2); 
    color: #f87171; 
}

.log-path { 
    color: var(--text-primary); 
    flex-grow: 1; 
    margin: 0 12px;
}

.log-ip { 
    color: var(--text-secondary); 
    font-size: 0.85rem;
}

.log-timestamp { 
    color: #666; 
    font-size: 0.8rem;
    margin-left: 12px;
}

.log-status { 
    font-weight: bold; 
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-left: 8px;
}

.status-2xx { 
    background: rgba(34, 197, 94, 0.2); 
    color: #4ade80; 
}

.status-3xx { 
    background: rgba(249, 115, 22, 0.2); 
    color: #fb923c; 
}

.status-4xx, .status-5xx { 
    background: rgba(239, 68, 68, 0.2); 
    color: #f87171; 
}

/* Animations */
@keyframes fadeIn { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.loader-wrapper {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 40px;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-text {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.app-footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 60px;
    border-top: 1px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        width: 95%;
        padding: 20px 0;
    }
    
    .app-header h1 {
        font-size: 2.5rem;
    }
    
    .app-header .subtitle {
        font-size: 1rem;
    }
    
    .tools-grid { 
        grid-template-columns: 1fr 1fr; 
        gap: 16px;
    }
    
    .tool-card {
        padding: 20px 16px;
    }
    
    .tool-card.tool-card-large { 
        grid-column: span 2; 
    }
    
    .card-description {
        font-size: 0.75rem;
    }
    
    .results-section {
        padding: 24px;
        margin: 30px 0;
    }
    
    .url-input-wrapper {
        padding: 6px 10px 6px 20px;
    }
    
    #url-input {
        font-size: 1rem;
        padding: 12px 8px;
    }
    
    .webhook-url-wrapper {
        flex-direction: column;
        gap: 12px;
    }
    
    input.webhook-url {
        width: 100%;
    }
    
    #copy-webhook-url {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .tool-card.tool-card-large {
        grid-column: span 1;
    }
    
    .app-header h1 {
        font-size: 2rem;
    }
    
    .results-table th,
    .results-table td {
        padding: 12px 8px;
        font-size: 0.85rem;
    }
}

/* Additional enhancements */
.ai-summary {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--accent-primary);
    padding: 16px 20px;
    border-radius: 8px;
    margin: 20px 0;
    font-style: italic;
    color: var(--text-secondary);
}

.ip-check-summary {
    background: rgba(34, 197, 94, 0.1);
    border-left: 4px solid var(--success-color);
    padding: 16px 20px;
    border-radius: 8px;
    margin: 20px 0;
    font-weight: 500;
}

.ip-list {
    list-style: none;
    padding: 0;
}

.ip-list li {
    background: var(--bg-surface);
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-weight: 500;
}

.raw-output {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
