/* Custom styles for Algorithm Kit documentation */

/* Custom quote widget styles */
.quote-widget {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 8px;
    margin: 2rem 0;
    text-align: center;
}

.quote-widget blockquote {
    font-size: 1.5rem;
    font-style: italic;
    margin: 0 0 1rem 0;
    border: none;
}

.quote-widget cite {
    font-size: 1rem;
    opacity: 0.9;
}

/* Custom button styles */
.md-button {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.md-button--primary {
    background-color: #667eea;
    color: white;
}

.md-button--primary:hover {
    background-color: #5a6fd8;
    transform: translateY(-1px);
}

/* Custom card grid styles */
.grid.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.grid.cards > div {
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.grid.cards > div:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

/* Custom mermaid diagram styles */
.mermaid {
    text-align: center;
    margin: 2rem 0;
}

/* Custom admonition styles */
.admonition {
    border-radius: 8px;
    border-left: 4px solid;
}

.admonition.tip {
    border-left-color: #28a745;
}

.admonition.note {
    border-left-color: #17a2b8;
}

.admonition.warning {
    border-left-color: #ffc107;
}

.admonition.important {
    border-left-color: #dc3545;
}

/* Custom code block styles */
.highlight {
    border-radius: 8px;
    border: 1px solid #e1e4e8;
}


/* Custom table styles */
.md-typeset table {
    border-radius: 8px !important;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e4e8;
    border-collapse: separate;
    border-spacing: 0;
}

.md-typeset table th {
    background-color: #667eea !important;
    color: white !important;
    font-weight: 600;
    padding: 1rem 0.75rem;
    border-bottom: 2px solid #5a6fd8;
}

.md-typeset table th:first-child {
    border-top-left-radius: 8px;
}

.md-typeset table th:last-child {
    border-top-right-radius: 8px;
}

.md-typeset table td {
    padding: 0.75rem;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: top;
}

.md-typeset table tr:hover {
    background-color: rgba(102, 126, 234, 0.05);
}

/* Dark mode table support */
[data-md-color-scheme="slate"] .md-typeset table th {
    background-color: #4a5568 !important;
    color: white !important;
    border-bottom-color: #2d3748;
}

[data-md-color-scheme="slate"] .md-typeset table td {
    border-bottom-color: #4a5568;
}

[data-md-color-scheme="slate"] .md-typeset table tr:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

/* Custom navigation styles */
.md-nav__link {
    transition: color 0.2s ease;
}

.md-nav__link:hover {
    color: #667eea;
}

/* Navigation tooltips */
.md-nav__link[title] {
    position: relative;
}

.md-nav__link[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    padding: 8px 12px;
    background-color: #333;
    color: white;
    border-radius: 4px;
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.md-nav__link[title]:hover::before {
    content: "";
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 4px;
    border: 5px solid transparent;
    border-right-color: #333;
    z-index: 1000;
    pointer-events: none;
}

/* Dark mode tooltip support */
[data-md-color-scheme="slate"] .md-nav__link[title]:hover::after {
    background-color: #f0f0f0;
    color: #333;
}

[data-md-color-scheme="slate"] .md-nav__link[title]:hover::before {
    border-right-color: #f0f0f0;
}

/* Custom footer styles */
.md-footer {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Back to Family Link Styling */
.back-to-family {
    display: inline-block;
    margin-bottom: 2rem;
    padding: 0.75rem 1.5rem;
    background-color: #667eea;
    color: white !important;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 2px solid #667eea;
}

.back-to-family:hover {
    background-color: #5a6fd8;
    transform: translateY(-1px);
    color: white !important;
    text-decoration: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border-color: #5a6fd8;
}

.back-to-family::before {
    content: "← ";
    margin-right: 0.5rem;
    font-weight: bold;
}

/* Ensure the link is always readable */
.back-to-family:visited {
    color: white !important;
}

.back-to-family:active {
    color: white !important;
}

/* Responsive design improvements */
@media (max-width: 768px) {
    .grid.cards {
        grid-template-columns: 1fr;
    }

    .quote-widget {
        padding: 1.5rem;
    }

    .quote-widget blockquote {
        font-size: 1.25rem;
    }
}

/* Family Link Admonition Styling */
.admonition.family-link {
    border-left-color: #667eea;
    background-color: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.admonition.family-link .admonition-title {
    background-color: #667eea;
    color: white;
    font-weight: 600;
}

.admonition.family-link .admonition-title::before {
    content: "🏠";
    margin-right: 0.5rem;
}

.admonition.family-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.admonition.family-link a:hover {
    color: #5a6fd8;
    text-decoration: underline;
}

/* Grid Layout Improvements */
.md-typeset .grid {
    gap: 1rem;
    padding: 1.5rem;
}

.md-typeset .grid > * {
    min-height: auto;
}

.md-typeset .grid > *:first-child {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 1.1em;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    background-color: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.md-typeset .grid > *:not(:first-child) {
    margin-bottom: 0.5rem;
}

/* Dark mode grid support */
[data-md-color-scheme="slate"] .md-typeset .grid > *:first-child {
    background-color: rgba(102, 126, 234, 0.15);
    border-color: rgba(102, 126, 234, 0.3);
}

/* Reference list styling */
.md-typeset .references ul li {
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

/* Enhanced References & Further Reading styling */
.references-container {
    margin: 24px 0;
}

.reference-category {
    margin-bottom: 32px;
    padding: 20px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--md-default-bg-color--lightest) 0%, var(--md-default-bg-color--light) 100%);
    border-left: 4px solid var(--md-primary-fg-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.reference-category:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.reference-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 8px;
    background: var(--md-default-bg-color);
    border: 1px solid var(--md-default-fg-color--lightest);
    transition: all 0.2s ease;
}

.reference-item:hover {
    background: var(--md-default-bg-color--lightest);
    border-color: var(--md-primary-fg-color--light);
    transform: translateX(4px);
}

.reference-icon {
    margin-right: 12px;
    margin-top: 2px;
    flex-shrink: 0;
    color: var(--md-primary-fg-color);
}

.reference-content {
    flex: 1;
}

.reference-title a {
    color: var(--md-primary-fg-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05em;
    transition: color 0.2s ease;
}

.reference-title a:hover {
    color: var(--md-accent-fg-color);
    text-decoration: underline;
}

.reference-meta {
    color: var(--md-default-fg-color--light);
    font-size: 0.9em;
    line-height: 1.4;
}

.reference-meta span:first-child {
    color: var(--md-accent-fg-color);
    font-weight: 500;
}

/* Dark mode adjustments */
[data-md-color-scheme="slate"] .reference-category {
    background: linear-gradient(135deg, var(--md-default-bg-color--lightest) 0%, var(--md-default-bg-color--light) 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-md-color-scheme="slate"] .reference-category:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
