/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2196F3;
    --success-color: #4CAF50;
    --warning-color: #FFC107;
    --error-color: #F44336;
    --accent-color: #9C27B0;
    --background-color: #f5f5f5;
    --surface-color: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
    --border-radius: 12px;
    --nav-height: 70px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    padding-bottom: var(--nav-height);
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 1rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.lang-toggle {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.lang-toggle:hover {
    background: rgba(255,255,255,0.3);
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

.section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.section.active {
    display: block;
}

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

/* Welcome Card */
.welcome-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.welcome-card h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.welcome-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.cta-button {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-size: 1.1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

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

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

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

/* Scanner Section */
.scanner-header {
    text-align: center;
    margin-bottom: 2rem;
}

.scanner-header h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.scanner-header p {
    color: var(--text-secondary);
}

.scan-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.scan-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.scan-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.scan-button.secondary {
    background: var(--accent-color);
}

.scan-button:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

/* Progress Bar */
.scan-progress {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.progress-bar {
    background: var(--border-color);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
}

/* Scan Results */
.scan-results {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.scan-results h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

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

.summary-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

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

/* Devices Section */
.devices-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.devices-header h2 {
    color: var(--primary-color);
}

.refresh-button {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.refresh-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.device-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.device-card:hover {
    transform: translateY(-2px);
}

.device-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.device-icon {
    font-size: 2rem;
}

.device-info h3 {
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.device-type {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.device-details {
    display: grid;
    gap: 0.5rem;
}

.device-detail {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.device-detail:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-secondary);
    font-weight: 500;
}

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

.no-devices {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.no-devices i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--border-color);
}

/* Security Section */
.security-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 2rem;
}

.security-header h2 {
    color: var(--primary-color);
}

.security-score {
    text-align: center;
}

.score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: conic-gradient(var(--success-color) 0deg, var(--border-color) 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    background: var(--surface-color);
    border-radius: 50%;
}

.score-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    position: relative;
    z-index: 1;
}

.score-max {
    font-size: 1rem;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
}

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

.recommendations-list {
    display: grid;
    gap: 1rem;
}

.recommendation-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
}

.recommendation-card.high-priority {
    border-left-color: var(--error-color);
}

.recommendation-card.medium-priority {
    border-left-color: var(--warning-color);
}

.recommendation-card.low-priority {
    border-left-color: var(--success-color);
}

.recommendation-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.recommendation-icon {
    font-size: 1.5rem;
}

.recommendation-title {
    color: var(--primary-color);
    font-weight: 600;
}

.recommendation-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.recommendation-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.action-button.secondary {
    background: var(--text-secondary);
}

.no-recommendations {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.no-recommendations i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--border-color);
}

/* Router Section */
.router-header {
    text-align: center;
    margin-bottom: 2rem;
}

.router-header h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.router-header p {
    color: var(--text-secondary);
}

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

.guide-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.guide-card:hover {
    transform: translateY(-2px);
}

.guide-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.guide-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.guide-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.guide-button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.guide-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Guide Modal */
.guide-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.guide-modal-content {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-hover);
}

.guide-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.guide-modal-header h3 {
    color: var(--primary-color);
}

.guide-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.guide-modal-close:hover {
    background: var(--background-color);
}

.guide-modal-body {
    padding: 1.5rem;
}

.guide-step {
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--background-color);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.guide-step h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.guide-step p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.guide-step ul {
    margin-left: 1rem;
    color: var(--text-secondary);
}

/* FAQ Section */
.faq-section {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: var(--shadow);
}

.faq-header {
    text-align: center;
    margin-bottom: 2rem;
}

.faq-header h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.faq-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 1.5rem 0;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.faq-question:hover {
    color: var(--primary-color);
}

.faq-icon {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 0 1.5rem 0;
    color: var(--text-secondary);
    line-height: 1.6;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
    }
}

/* Footer */
footer {
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 2rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 100;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    min-width: 60px;
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.nav-item span {
    font-size: 0.75rem;
    font-weight: 500;
}

.nav-item.active {
    color: var(--primary-color);
    background: rgba(33, 150, 243, 0.1);
}

.nav-item:hover {
    color: var(--primary-color);
    background: rgba(33, 150, 243, 0.05);
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        padding: 0.5rem;
    }
    
    .header h1 {
        font-size: 1.2rem;
    }
    
    .welcome-card {
        padding: 1.5rem;
    }
    
    .welcome-card h2 {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    
    .scan-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .scan-button {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .devices-grid {
        grid-template-columns: 1fr;
    }
    
    .security-header {
        flex-direction: column;
        text-align: center;
    }
    
    .router-guides {
        grid-template-columns: 1fr;
    }
    
    .guide-modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    .nav-item span {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .welcome-icon {
        font-size: 3rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .device-card {
        padding: 1rem;
    }
    
    .recommendation-card {
        padding: 1rem;
    }
    
    .guide-card {
        padding: 1.5rem;
    }
    
    .faq-section {
        padding: 1rem;
    }
    
    .faq-question {
        font-size: 1rem;
        padding: 1rem 0;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Utility Classes */
.hidden {
    display: none !important;
}

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

.text-success {
    color: var(--success-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-error {
    color: var(--error-color);
}

.bg-success {
    background-color: var(--success-color);
}

.bg-warning {
    background-color: var(--warning-color);
}

.bg-error {
    background-color: var(--error-color);
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}
