:root {
    --django-green: #0C4B33;
    --django-light-green: #44B78B;
    --django-dark-green: #082E20;
}

.bg-django {
    background-color: var(--django-green) !important;
}

.text-django {
    color: var(--django-green) !important;
}

.btn-django {
    background-color: var(--django-green);
    color: white;
}

.btn-django:hover {
    background-color: var(--django-dark-green);
    color: white;
}

.hero-section {
    background: linear-gradient(135deg, var(--django-green) 0%, var(--django-light-green) 100%);
    color: white;
    padding: 3rem 0;
}

.feature-icon {
    width: 60px;
    height: 60px;
    background-color: var(--django-light-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.card-hover {
    transition: transform 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
}

.code-block {
    background-color: #f8f9fa;
    border-radius: 5px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
}

.chapter-title {
    border-bottom: 2px solid var(--django-green);
    padding-bottom: 10px;
    margin-bottom: 30px;
}

.navbar-brand img {
    filter: brightness(0) invert(1);
}

.template-example {
    border: 1px solid #dee2e6;
    border-radius: 5px;
    margin: 20px 0;
}

.template-example .example-header {
    background-color: #e9ecef;
    padding: 10px 15px;
    border-bottom: 1px solid #dee2e6;
    font-weight: bold;
}

.template-example .example-content {
    padding: 15px;
}

.template-diagram {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.template-diagram .diagram-item {
    display: inline-block;
    margin: 10px;
    padding: 15px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-width: 150px;
}

.template-diagram .arrow {
    font-size: 24px;
    color: var(--django-green);
    margin: 0 10px;
}

.badge-django {
    background-color: var(--django-green);
    color: white;
}

/* 缓存特定样式 */
.cache-flow {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.cache-flow .flow-step {
    text-align: center;
    padding: 15px;
}

.cache-flow .flow-number {
    display: inline-block;
    width: 40px;
    height: 40px;
    background-color: var(--django-green);
    color: white;
    border-radius: 50%;
    line-height: 40px;
    margin-bottom: 10px;
}

.cache-example {
    border: 1px solid #dee2e6;
    border-radius: 5px;
    margin: 20px 0;
    background-color: white;
}

.cache-example .cache-header {
    background-color: var(--django-green);
    color: white;
    padding: 10px 15px;
    border-bottom: 1px solid #dee2e6;
    font-weight: bold;
}

.cache-example .cache-content {
    padding: 20px;
}

.cache-type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-right: 5px;
}

.badge-memory { background-color: #007bff; color: white; }
.badge-file { background-color: #28a745; color: white; }
.badge-database { background-color: #dc3545; color: white; }
.badge-redis { background-color: #6f42c1; color: white; }
.badge-memcached { background-color: #fd7e14; color: white; }

.cache-level {
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
}

.level-site {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.level-view {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.level-template {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.level-api {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.hook-badge {
    background-color: #fd7e14;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    margin-left: 5px;
}

.method-badge {
    background-color: #e83e8c;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    margin-left: 5px;
}

.cache-comparison {
    display: flex;
    gap: 20px;
    margin: 20px 0;
}

.cache-comparison > div {
    flex: 1;
}

.cache-timeline {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
    margin: 10px 0;
}

.timeline-item {
    display: flex;
    align-items: center;
    margin: 10px 0;
    padding: 10px;
    border-left: 3px solid var(--django-green);
    background-color: white;
}

.timeline-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--django-green);
    margin-right: 15px;
    flex-shrink: 0;
}

.timeline-content {
    flex-grow: 1;
}

.copy-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.copy-btn:hover {
    opacity: 1;
}

/* 缓存后端样式 */
.cache-backends {
    border-collapse: collapse;
    width: 100%;
}

.cache-backends th,
.cache-backends td {
    border: 1px solid #dee2e6;
    padding: 8px;
    text-align: left;
}

.cache-backends th {
    background-color: #e9ecef;
    font-weight: bold;
}

.cache-active {
    background-color: #d4edda;
}

.cache-inactive {
    background-color: #f8f9fa;
}

.order-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: var(--django-green);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
    font-size: 0.8rem;
    margin-right: 5px;
}

.cache-params {
    background-color: #f8f9fa;
    border-left: 4px solid var(--django-green);
    padding: 10px 15px;
    margin: 10px 0;
}

.param-name {
    font-weight: bold;
    color: var(--django-green);
}

.connection-method {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    background-color: #6c757d;
    color: white;
    font-size: 0.75rem;
    margin: 0 2px;
}

/* 性能指标样式 */
.performance-metric {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
}

.metric-high {
    background-color: #d4edda;
    border: 2px solid #28a745;
}

.metric-medium {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
}

.metric-low {
    background-color: #f8d7da;
    border: 2px solid #dc3545;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 5px 0;
}

.metric-label {
    font-size: 0.9rem;
    color: #6c757d;
}

.cache-hit-miss {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
}

.hit-miss-item {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    flex: 1;
    margin: 0 10px;
}

.hit {
    background-color: #d4edda;
    border: 2px solid #28a745;
}

.miss {
    background-color: #f8d7da;
    border: 2px solid #dc3545;
}
