/* Custom styling for DataFrame Expectations documentation */

/* Expectation Gallery Cards - Theme-aware styling */
.expectations-gallery {
    margin: 2rem 0;
    padding: 0;
    width: 100%;
}

/* Category and subcategory titles - scoped to expectations gallery */
.expectations-gallery .category-title,
.expectations-gallery h1.category-title,
.expectations-gallery h2.category-title {
    color: var(--pst-color-primary);
    border-bottom: 3px solid var(--pst-color-primary);
    padding-bottom: 10px;
    margin: 2em 0 1em 0;
    font-size: 1.4em;
    font-weight: bold;
}

.expectations-gallery .subcategory-title {
    color: var(--pst-color-text-base);
    margin: 1.5em 0 1em 0;
    font-size: 1.2em;
    font-weight: bold;
}

/* Card grid layout */
.expectations-gallery .cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin: 1rem 0;
    align-items: start;
    padding: 0;
    width: 100%;
    max-width: none;
}

/* Individual expectation card */
.expectation-card {
    border: 1px solid var(--pst-color-border);
    border-radius: 6px;
    background: var(--pst-color-code-bg, var(--pst-color-surface));
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    margin: 0;
    width: 100%;
    min-width: 320px;
}

.expectation-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
    border-color: var(--pst-color-primary);
}

/* Highlight card when navigated via anchor link */
:target.expectation-card {
    border: 1px solid var(--pst-color-primary) !important;
    animation: highlight-pulse 5s ease-in-out;
}

@keyframes highlight-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 138, 0, 0.4);
    }
    10% {
        box-shadow: 0 0 0 10px rgba(255, 138, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 138, 0, 0.1);
    }
    100% {
        box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.2);
    }
}

/* Dark mode specific card shadow */
html[data-theme="dark"] .expectation-card {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .expectation-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Card header - scoped to expectation cards only */
.expectation-card .card-header {
    background: var(--pst-color-code-bg, var(--pst-color-surface));
    padding: 10px 12px;
    border-bottom: 1px solid var(--pst-color-border);
    min-height: 40px;
    display: flex;
    align-items: center;
}

.expectation-card .method-name {
    font-family: var(--pst-font-family-monospace);
    font-size: 0.95em;
    font-weight: bold;
    color: var(--pst-color-primary);
    margin: 0;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.2;
}

/* Card body - scoped to expectation cards only */
.expectation-card .card-body {
    padding: 10px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.expectation-card .card-description {
    color: var(--pst-color-text-base);
    margin-bottom: 8px;
    line-height: 1.3;
    font-size: 0.9em;
}

/* Tags - scoped to expectation cards only */
.expectation-card .tags-container {
    margin: 6px 0;
}

.expectation-card .tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7em;
    margin-right: 4px;
    margin-bottom: 3px;
}

.expectation-card .category-tag {
    background: var(--pst-color-primary-bg);
    color: var(--pst-color-primary);
    border: 1px solid var(--pst-color-primary);
}

.expectation-card .subcategory-tag {
    background: rgba(123, 31, 162, 0.1);
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

/* Dark mode adjustments for tags */
html[data-theme="dark"] .expectation-card .subcategory-tag {
    background: rgba(206, 147, 216, 0.2);
    color: #ce93d8;
}

/* Parameters preview - scoped to expectation cards only */
.expectation-card .params-preview {
    margin-top: 6px;
    padding: 6px 8px;
    background: var(--pst-color-code-bg, var(--pst-color-surface));
    border: 1px solid var(--pst-color-border);
    border-radius: 3px;
}

.expectation-card .params-title {
    font-weight: bold;
    color: var(--pst-color-text-base);
    margin: 0 0 3px 0;
    font-size: 0.75em;
}

.expectation-card .params-list {
    font-family: var(--pst-font-family-monospace);
    font-size: 0.75em;
    color: var(--pst-color-text-muted);
    margin: 0;
}

/* Card footer - scoped to expectation cards only */
.expectation-card .card-footer {
    padding: 8px 12px;
    background: var(--pst-color-code-bg, var(--pst-color-surface));
    border-top: 1px solid var(--pst-color-border);
    text-align: right;
    margin-top: auto;
}

/* Buttons - scoped to expectation cards only */
.expectation-card .btn {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 3px;
    text-decoration: none;
    font-size: 0.8em;
    font-weight: 500;
    transition: all 0.2s ease;
}

.expectation-card .btn-details {
    background: var(--pst-color-primary);
    color: var(--pst-color-on-primary) !important;
    border: 1px solid var(--pst-color-primary);
    text-decoration: none !important;
}

.expectation-card .btn-details:hover {
    opacity: 0.85;
    text-decoration: none !important;
}

/* Responsive design */
@media (max-width: 1400px) {
    .expectations-gallery .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 14px;
    }
}

@media (max-width: 1200px) {
    .expectations-gallery .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 12px;
    }

    .expectation-card {
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .expectations-gallery .cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin: 0.75rem 0;
        padding: 0;
    }

    .expectation-card {
        margin: 0;
        min-height: 160px;
        min-width: auto;
    }
}

/* Allow class signatures to wrap properly */
dt.sig.sig-object.py {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

/* Specifically target the class name within signatures */
dt.sig.sig-object.py .sig-prename,
dt.sig.sig-object.py .sig-name {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Summary Table Styling */
.summary-table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
}

.summary-table-header {
    background: var(--pst-color-primary);
    color: white;
    font-weight: 600;
    text-align: left;
}

.summary-table-header p {
    margin: 0;
    padding: 10px 12px;
}

.summary-table-row {
    border-bottom: 1px solid var(--pst-color-border);
}

.summary-category-cell {
    background: var(--pst-color-code-bg, var(--pst-color-surface));
    border-right: 2px solid var(--pst-color-primary);
    vertical-align: top;
    font-weight: 600;
    color: var(--pst-color-primary);
}

.summary-category-cell p {
    margin: 0;
    padding: 12px;
    font-size: 0.95em;
}

.summary-subcategory-cell {
    background: var(--pst-color-surface);
    vertical-align: top;
    font-weight: 500;
    color: var(--pst-color-text-base);
}

.summary-subcategory-cell p {
    margin: 0;
    padding: 10px 12px;
    font-size: 0.9em;
}

.summary-expectations-cell {
    background: var(--pst-color-surface);
    padding: 8px 12px;
    vertical-align: top;
}

/* Expectation badges container */
.expectation-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
}

/* Individual expectation badge */
.expectation-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--pst-color-code-bg, var(--pst-color-surface));
    border: 1px solid var(--pst-color-border);
    border-radius: 4px;
    font-family: var(--pst-font-family-monospace);
    font-size: 0.8em;
    color: var(--pst-color-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.expectation-badge:hover {
    background: var(--pst-color-primary);
    color: white;
    border-color: var(--pst-color-primary);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

html[data-theme="dark"] .expectation-badge:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Responsive adjustments for summary table */
@media (max-width: 1200px) {
    .expectation-badge {
        font-size: 0.75em;
        padding: 3px 8px;
    }
}

@media (max-width: 768px) {
    .summary-table {
        font-size: 0.9em;
    }

    .summary-category-cell p,
    .summary-subcategory-cell p {
        padding: 8px;
        font-size: 0.85em;
    }

    .summary-expectations-cell {
        padding: 6px 8px;
    }

    .expectation-badges {
        gap: 4px;
    }

    .expectation-badge {
        font-size: 0.7em;
        padding: 3px 6px;
    }
}
