/* Lesson 3 CSS - Box Model Examples */

/* 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: 1200px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
}

/* Header styling */
.example-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 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: 2rem;
    margin-bottom: 2rem;
}

.demo-section h3 {
    color: #10b981;
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
}

/* Box Model Demo */
.box-model-demo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.controls-panel {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #374151;
}

.control-group input[type="range"] {
    width: 100%;
    margin: 0.5rem 0;
}

.control-group span {
    display: inline-block;
    min-width: 50px;
    font-weight: 500;
    color: #10b981;
}

.box-model-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 2rem;
}

.box-model-element {
    background: #dbeafe;
    border: 5px solid #3b82f6;
    border-radius: 8px;
    position: relative;
    transition: all 0.3s ease;
}

.content-area {
    background: #fef3c7;
    color: #92400e;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

.box-model-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.label {
    position: absolute;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.margin-label {
    top: 10px;
    left: 10px;
    background: #ef4444;
}

.border-label {
    top: 35px;
    left: 35px;
    background: #3b82f6;
}

.padding-label {
    top: 60px;
    left: 60px;
    background: #10b981;
}

.content-label {
    top: 85px;
    left: 85px;
    background: #f59e0b;
}

.calculations {
    grid-column: 1 / -1;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.calc-item {
    padding: 1rem;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 4px solid #e2e8f0;
}

.calc-item.total {
    border-left-color: #10b981;
    background: #ecfdf5;
    font-size: 1.1rem;
}

/* Box Sizing Demo */
.box-sizing-demo {
    text-align: center;
}

.sizing-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.box-example {
    width: 200px;
    padding: 20px;
    border: 5px solid #3b82f6;
    margin: 0 auto;
    background: #dbeafe;
    border-radius: 8px;
    transition: all 0.5s ease;
}

.content-box {
    box-sizing: content-box;
}

.border-box {
    box-sizing: border-box;
}

.toggle-container {
    margin-top: 2rem;
}

.interactive-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.interactive-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.toggle-info {
    margin-top: 1rem;
    color: #6b7280;
    font-style: italic;
}

/* Margin Collapsing Demo */
.margin-demo {
    max-width: 600px;
    margin: 0 auto;
}

.margin-example {
    position: relative;
    background: #f1f5f9;
    padding: 2rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.margin-box {
    background: #dbeafe;
    border: 2px solid #3b82f6;
    padding: 1rem;
    text-align: center;
    border-radius: 6px;
    font-weight: 500;
}

.first-box {
    margin-bottom: 30px;
    background: #fef2f2;
    border-color: #ef4444;
    color: #dc2626;
}

.second-box {
    margin-top: 20px;
    background: #f0fdf4;
    border-color: #10b981;
    color: #059669;
}

.actual-margin {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #fbbf24;
    color: #92400e;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 10;
}

.margin-controls {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
    margin-top: 2rem;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
}

/* Padding vs Margin Demo */
.padding-margin-demo {
    text-align: center;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.example-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.demo-element {
    background: #3b82f6;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    margin: 1rem 0;
}

.padding-demo-element {
    padding: 2rem;
}

.padding-demo-element:hover {
    background: #1d4ed8;
}

.margin-demo-element {
    padding: 1rem;
    margin: 2rem;
}

.margin-demo-element:hover {
    background: #1d4ed8;
}

.feedback-message {
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-weight: 500;
}

.feedback-message.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.feedback-message.warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Border Styles Showcase */
.border-showcase {
    max-width: 800px;
    margin: 0 auto;
}

.border-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.border-example {
    padding: 1rem;
    text-align: center;
    background: white;
    border-width: 4px;
    border-color: #3b82f6;
    font-weight: 600;
    border-radius: 8px;
}

.solid-border { border-style: solid; }
.dashed-border { border-style: dashed; }
.dotted-border { border-style: dotted; }
.double-border { border-style: double; }
.groove-border { border-style: groove; }
.ridge-border { border-style: ridge; }
.inset-border { border-style: inset; }
.outset-border { border-style: outset; }

.border-customizer {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    margin-top: 2rem;
}

.customizer-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.control-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-row label {
    font-weight: 600;
    color: #374151;
}

.control-row select,
.control-row input[type="range"] {
    padding: 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 1rem;
}

.control-row input[type="color"] {
    width: 100%;
    height: 40px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
}

.custom-border-preview {
    background: white;
    padding: 2rem;
    text-align: center;
    font-weight: 600;
    border-radius: 8px;
    margin-top: 1.5rem;
    border: 5px solid #3b82f6;
    font-size: 1.1rem;
}

/* Practice Section */
.practice-section {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-color: #f59e0b;
}

.exercise {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    margin: 1rem 0;
}

.exercise-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.target-design,
.user-design {
    text-align: center;
}

.target-card {
    background: #dbeafe;
    border: 2px solid #3b82f6;
    padding: 20px;
    margin: 15px;
    border-radius: 8px;
    color: #1e40af;
    font-weight: 600;
    display: inline-block;
}

.user-card {
    background: #fef2f2;
    border: 1px solid #ef4444;
    padding: 10px;
    margin: 5px;
    border-radius: 8px;
    color: #dc2626;
    font-weight: 600;
    display: inline-block;
    transition: all 0.3s ease;
}

.practice-controls {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: center;
    margin: 1.5rem 0;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
}

.exercise-feedback {
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-weight: 500;
    text-align: center;
}

.exercise-feedback.success {
    background: #dcfce7;
    color: #166534;
    border: 2px solid #bbf7d0;
}

/* Reference Section */
.reference-section {
    background: linear-gradient(135deg, #f0f9ff, #dbeafe);
    border-color: #3b82f6;
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.reference-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.reference-card h4 {
    color: #3b82f6;
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
}

.reference-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.reference-card li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.reference-card li:last-child {
    border-bottom: none;
}

/* 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;
}

/* Footer */
.example-footer {
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    padding: 2rem;
    text-align: center;
}

/* Responsive design */
@media (max-width: 768px) {
    .example-header {
        padding: 1.5rem 1rem;
    }
    
    .example-content {
        padding: 1rem;
    }
    
    .box-model-demo {
        grid-template-columns: 1fr;
    }
    
    .sizing-comparison,
    .comparison-grid,
    .exercise-container {
        grid-template-columns: 1fr;
    }
    
    .border-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .customizer-controls {
        grid-template-columns: 1fr;
    }
    
    .margin-controls,
    .practice-controls {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .calc-grid {
        grid-template-columns: 1fr;
    }
}
