/* Base Styles */
:root {
    --primary-color: #3498db;
    --primary-color-hover: #2980b9;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --light-color: #ecf0f1;
    --border-radius: 5px;
    --box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--secondary-color);
    background-color: #f8f9fa;
    margin: 0;
    padding: 0;
}
/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}
/* Header & Footer */
.page-header {
    background-color: var(--secondary-color);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}
.page-footer {
    background-color: var(--secondary-color);
    color: white;
    text-align: center;
    padding: 15px;
    margin-top: 40px;
}
/* Back Button */
.back-button {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    transition: var(--transition);
}
.back-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}
/* Section Styling */
.theory-section, .example-section {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 25px;
    margin-bottom: 30px;
}
.info-box {
    background-color: #f8f9fa;
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    margin: 20px 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}
/* Interactive Demo Styling */
.interactive-demo {
    margin: 30px 0;
}
.demo-container {
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 20px;
    margin: 15px 0;
    overflow: hidden;
}
.demo-box {
    margin-bottom: 20px;
}
.code-display {
    background-color: var(--secondary-color);
    border-radius: var(--border-radius);
    padding: 15px;
    overflow-x: auto;
}
.code-display pre {
    margin: 0;
}
.code-display code {
    color: var(--light-color);
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}
/* Float Examples */
.float-example {
    overflow: hidden;
    margin-bottom: 20px;
}
.float-item {
    width: 120px;
    height: 80px;
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    line-height: 80px;
    border-radius: var(--border-radius);
}
.float-left {
    float: left;
    margin-right: 15px;
}
.float-right {
    float: right;
    margin-left: 15px;
}
/* Clear Examples */
.clear-example {
    overflow: hidden;
}
.clear-left, .clear-right, .clear-both {
    background-color: #f1f1f1;
    padding: 10px;
    margin: 10px 0;
    border-radius: var(--border-radius);
}
.clear-left {
    clear: left;
    border-left: 4px solid var(--primary-color);
}
.clear-right {
    clear: right;
    border-left: 4px solid var(--accent-color);
}
.clear-both {
    clear: both;
    border-left: 4px solid var(--secondary-color);
}
/* Clearfix Examples */
.collapsed-container {
    border: 2px dashed #ccc;
    padding: 10px;
    /* No clearfix applied */
}
.clearfix-container {
    border: 2px dashed #ccc;
    padding: 10px;
}
/* Modern clearfix using ::after pseudo-element */
.clearfix-container::after {
    content: "";
    display: block;
    clear: both;
}
.demo-note {
    font-style: italic;
    color: #666;
    margin-top: 10px;
}
/* Practical Examples */
.text-wrap-example {
    overflow: hidden;
}
.float-image {
    float: left;
    width: 150px;
    height: 150px;
    margin-right: 15px;
    background-color: #3498db;
    background-image: url('../images/css_favicon.png');
    background-size: 50px;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: var(--border-radius);
}
.column-layout-example {
    overflow: hidden;
}
.float-column {
    float: left;
    width: 30%;
    margin-right: 5%;
    padding: 15px;
    box-sizing: border-box;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    min-height: 150px;
}

.float-column:last-child {
    margin-right: 0;
}

/* Interactive Playground */
.interactive-playground {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 25px;
    margin-bottom: 30px;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.control-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.control-btn:hover {
    background-color: var(--primary-color-hover);
}

.playground-container {
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 20px;
}

.playground-box {
    overflow: hidden;
    margin-bottom: 20px;
    min-height: 200px;
}

.playground-item {
    width: 150px;
    height: 100px;
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.playground-text {
    margin-top: 10px;
}

.current-styles {
    margin-top: 20px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .float-column {
        float: none;
        width: 100%;
        margin-right: 0;
        margin-bottom: 20px;
    }
    
    .controls {
        flex-direction: column;
    }
    
    .back-button {
        position: static;
        display: inline-block;
        margin-bottom: 15px;
        transform: none;
    }
    
    .page-header {
        padding-top: 15px;
    }
}
