/* CSS Variables */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --critical-color: #dc2626;
    --high-color: #ea580c;
    --medium-color: #f59e0b;
    --low-color: #22c55e;
    --info-color: #3b82f6;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.2s ease;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base Styles */
html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #8b5cf6 100%);
    color: white;
    padding: 3rem 1.5rem;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.shield-icon {
    width: 40px;
    height: 40px;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.tagline {
    opacity: 0.9;
    font-size: 1.1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Scanner Section */
.scanner-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.url-input-wrapper {
    display: flex;
    gap: 0.75rem;
}

#url-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition);
}

#url-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

#url-input::placeholder {
    color: var(--text-secondary);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

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

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-primary .btn-loading {
    display: none;
}

.btn-primary.loading .btn-text {
    display: none;
}

.btn-primary.loading .btn-loading {
    display: block;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

.input-hint {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Results Section */
.results-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.results-section.hidden {
    display: none;
}

.results-header {
    margin-bottom: 1.5rem;
}

.results-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.results-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.scan-url {
    word-break: break-all;
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    text-align: center;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-color);
}

.summary-card .count {
    display: block;
    font-size: 2rem;
    font-weight: 700;
}

.summary-card .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.summary-card.critical .count { color: var(--critical-color); }
.summary-card.high .count { color: var(--high-color); }
.summary-card.medium .count { color: var(--medium-color); }
.summary-card.low .count { color: var(--low-color); }
.summary-card.info .count { color: var(--info-color); }

/* Overall Score */
.overall-score {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

.score-circle {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.score-circle svg {
    width: 100%;
    height: 100%;
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

#score-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.score-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.score-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.score-info p {
    color: var(--text-secondary);
}

/* Vulnerabilities List */
.vulnerabilities-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.vulnerability-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.vulnerability-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.vulnerability-header:hover {
    background: var(--bg-color);
}

.severity-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.severity-badge.critical {
    background: #fef2f2;
    color: var(--critical-color);
}

.severity-badge.high {
    background: #fff7ed;
    color: var(--high-color);
}

.severity-badge.medium {
    background: #fffbeb;
    color: var(--medium-color);
}

.severity-badge.low {
    background: #f0fdf4;
    color: var(--low-color);
}

.severity-badge.info {
    background: #eff6ff;
    color: var(--info-color);
}

.severity-badge.pass {
    background: #f0fdf4;
    color: #16a34a;
}

.vulnerability-title {
    flex: 1;
    font-weight: 600;
}

.vulnerability-toggle {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.vulnerability-item.expanded .vulnerability-toggle {
    transform: rotate(180deg);
}

.vulnerability-details {
    display: none;
    padding: 1rem;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
}

.vulnerability-item.expanded .vulnerability-details {
    display: block;
}

.detail-section {
    margin-bottom: 1rem;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h4 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-section p {
    color: var(--text-primary);
}

.recommendation {
    background: #fef3c7;
    border-left: 3px solid var(--medium-color);
    padding: 0.75rem 1rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Report Actions */
.report-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-secondary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-secondary svg {
    width: 18px;
    height: 18px;
}

/* Info Section */
.info-section {
    margin-bottom: 2rem;
}

.info-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.checks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.check-item {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.check-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.check-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.check-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.check-item h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.check-item p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Disclaimer Section */
.disclaimer-section {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.disclaimer-section h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #92400e;
}

.disclaimer-section p {
    font-size: 0.875rem;
    color: #92400e;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    text-align: center;
    padding: 1.5rem;
}

.footer a {
    color: #a5b4fc;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.footer a:hover {
    color: white;
    text-decoration: underline;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.hidden {
    display: none;
}

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

    .logo h1 {
        font-size: 1.5rem;
    }

    .shield-icon {
        width: 32px;
        height: 32px;
    }

    .main-content {
        padding: 1.5rem 1rem;
    }

    .scanner-section,
    .results-section {
        padding: 1.5rem;
    }

    .url-input-wrapper {
        flex-direction: column;
    }

    .btn-primary {
        width: 100%;
    }

    .summary-cards {
        grid-template-columns: repeat(3, 1fr);
    }

    .summary-cards .summary-card:nth-child(4),
    .summary-cards .summary-card:nth-child(5) {
        grid-column: span 1;
    }

    .overall-score {
        flex-direction: column;
        text-align: center;
    }

    .checks-grid {
        grid-template-columns: 1fr;
    }

    .report-actions {
        flex-direction: column;
    }

    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-cards .summary-card:last-child {
        grid-column: span 2;
    }

    .vulnerability-header {
        flex-wrap: wrap;
    }

    .vulnerability-title {
        order: 3;
        width: 100%;
        margin-top: 0.5rem;
    }
}

/* Print Styles */
@media print {
    .header {
        background: none;
        color: var(--text-primary);
        padding: 1rem 0;
    }

    .scanner-section,
    .info-section,
    .disclaimer-section,
    .report-actions {
        display: none;
    }

    .results-section {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }

    .vulnerability-details {
        display: block !important;
    }

    .footer {
        background: none;
        color: var(--text-primary);
    }

    .footer a {
        color: var(--primary-color);
    }
}
