/* CSS Styles for Red-Black Trees Web Page */

/* Element name selectors */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
}

header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 2rem;
}

section {
    background: white;
    margin-bottom: 2rem;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 300;
}

h2 {
    color: #2c3e50;
    border-bottom: 3px solid #e74c3c;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

h3 {
    color: #34495e;
    margin-top: 1.5rem;
}

ol, ul {
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

a {
    color: #3498db;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Class name selectors */
.subtitle {
    font-size: 1.2rem;
    font-weight: 300;
    margin: 0.5rem 0 0 0;
    opacity: 0.9;
}

.highlight {
    background-color: #f39c12;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.operation-list {
    background-color: #ecf0f1;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.operation-list li {
    margin-bottom: 0.8rem;
}

.image-container {
    text-align: center;
    margin: 2rem 0;
}

.image-caption {
    font-style: italic;
    color: #7f8c8d;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.advantages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.advantage-item {
    background-color: #f8f9fa;
    padding: 1.5rem;
    border-radius: 6px;
    border: 2px solid #e9ecef;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.advantage-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: #3498db;
}

.advantage-item h3 {
    margin-top: 0;
    color: #e74c3c;
}

.footer-text {
    margin: 0.5rem 0;
}

.external-link {
    color: #f39c12;
    font-weight: bold;
}

.external-link:hover {
    color: #e67e22;
}

/* ID selectors */
#main-title {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

#introduction {
    border-left: 5px solid #e74c3c;
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
}

#properties {
    border-left: 5px solid #f39c12;
}

#properties ol {
    background-color: #fef9e7;
    padding: 1.5rem;
    border-radius: 6px;
}

#properties ol li {
    font-weight: 500;
    color: #2c3e50;
}

#operations {
    border-left: 5px solid #3498db;
}

#visualization {
    border-left: 5px solid #27ae60;
    text-align: center;
}

#tree-diagram {
    border: 3px solid #bdc3c7;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    max-width: 600px;
    margin: 1rem auto;
    display: block;
}

#advantages {
    border-left: 5px solid #9b59b6;
}

/* Responsive design */
@media (max-width: 768px) {
    main {
        padding: 0 1rem;
    }
    
    section {
        padding: 1.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .advantages-grid {
        grid-template-columns: 1fr;
    }
}

/* Animation for page load */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section {
    animation: fadeIn 0.6s ease-out;
}