/* Lesson 2 CSS - Selectors Example */

/* Base styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    margin: 0;
    background: #f8fafc;
    color: #1e293b;
}

/* Example container */
.example-container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
}

/* Header styling */
.example-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.example-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.lesson-subtitle {
    margin: 0 0 2rem 0;
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Navigation */
.example-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-link {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Content area */
.example-content {
    padding: 2rem;
}

/* Demo sections */
.demo-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.demo-section h3 {
    color: #3b82f6;
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
}

/* Element selector examples */
p {
    color: #374151;
    margin-bottom: 1rem;
}

h4 {
    color: #1e293b;
    font-size: 1.1rem;
    margin: 0.5rem 0;
}

/* Class selector examples */
.highlight {
    background: linear-gradient(135deg, #fef3c7, #fbbf24);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
    margin: 1rem 0;
}

.card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card.featured {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-color: #3b82f6;
    border-width: 2px;
}

/* ID selector example */
#unique-element {
    background: linear-gradient(135deg, #ecfdf5, #a7f3d0);
    border: 2px solid #10b981;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

/* Descendant selector examples */
.navigation {
    background: #1e293b;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.navigation ul {
    list-style: none;
    display: flex;
    gap: 1rem;
    margin: 0;
    padding: 0;
}

.navigation a {
    color: #e2e8f0;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.navigation a:hover {
    background: #374151;
    color: white;
}

.navigation p {
    color: #94a3b8;
    margin: 1rem 0 0 0;
    font-size: 0.9rem;
}

/* Child selector examples */
.parent {
    background: #fef2f2;
    border: 2px dashed #ef4444;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.parent > p {
    background: #fee2e2;
    color: #dc2626;
    padding: 0.5rem;
    border-radius: 4px;
    margin: 0.5rem 0;
    font-weight: 500;
}

/* Pseudo-class examples */
.pseudo-examples {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    margin: 1rem 0;
}

.interactive-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.interactive-btn:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.demo-link {
    color: #3b82f6;
    text-decoration: underline;
    font-weight: 500;
    transition: all 0.2s ease;
}

.demo-link:hover {
    color: #1d4ed8;
    text-decoration: none;
}

input {
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s ease;
    min-width: 200px;
}

input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Attribute selector examples */
.attribute-demo {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    margin: 1rem 0;
}

input[type="email"] {
    border-color: #10b981;
    background: #f0fdf4;
}

input[type="email"]:focus {
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

button[type="submit"] {
    background: #059669;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

button[type="submit"]:hover {
    background: #047857;
}

/* Selector playground */
.selector-playground {
    background: #f1f5f9;
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
}

.playground-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.playground-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.playground-item:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
}

.playground-item.highlighted {
    background: #fef3c7;
    border-color: #f59e0b;
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

.selector-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 2rem;
}

.selector-controls button {
    background: #6b7280;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.selector-controls button:hover {
    background: #374151;
}

/* Specificity demo */
.specificity-demo {
    background: #fef2f2;
    padding: 2rem;
    border-radius: 12px;
    margin: 2rem 0;
}

#special-text {
    color: #dc2626 !important; /* This wins! */
    background: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 1.1rem;
}

.specificity-rules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.rule {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.rule.winner {
    border-color: #dc2626;
    background: #fef2f2;
}

.rule code {
    display: block;
    background: #f1f5f9;
    padding: 0.5rem;
    border-radius: 4px;
    font-family: 'Monaco', monospace;
    margin-bottom: 0.5rem;
}

.score {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.winner .score {
    color: #dc2626;
    font-weight: 600;
}

/* Footer */
.example-footer {
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    padding: 2rem;
    text-align: center;
}

/* Code elements */
code {
    background: #f1f5f9;
    color: #1e293b;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

/* Responsive design */
@media (max-width: 768px) {
    .example-header {
        padding: 1.5rem 1rem;
    }
    
    .example-content {
        padding: 1rem;
    }
    
    .pseudo-examples,
    .attribute-demo {
        flex-direction: column;
        align-items: stretch;
    }
    
    .playground-grid {
        grid-template-columns: 1fr;
    }
    
    .selector-controls {
        flex-direction: column;
    }
}
