/* ==========================================================================
   DC MAGAZÍN – Styles
   ========================================================================== */

:root {
    --dcm-grid-gap: 30px;
    --dcm-card-bg: #ffffff;
    --dcm-card-border: #e5e5e5;
    --dcm-card-radius: 0;
    --dcm-title-color: #1a1a1a;
    --dcm-title-size: 1.5rem;
    --dcm-excerpt-color: #444;
    --dcm-date-color: #777;
    --dcm-link-color: #1a1a1a;
    --dcm-badge-radius: 2px;
    --dcm-sidebar-width: 280px;
    --dcm-layout-gap: 40px;
}

/* Reset box-sizing for plugin elements */
[class^="dcm-"],
[class*=" dcm-"] {
    box-sizing: border-box;
}

/* ==========================================================================
   LAYOUT (combined shortcode)
   ========================================================================== */

.dcm-layout {
    display: flex;
    gap: var(--dcm-layout-gap);
    align-items: flex-start;
    max-width: 1200px;
    margin: 0 auto;
}

.dcm-main {
    flex: 1;
    min-width: 0;
}

.dcm-sidebar {
    width: var(--dcm-sidebar-width);
    flex-shrink: 0;
}

/* ==========================================================================
   GRID WRAPPER (AJAX target)
   ========================================================================== */

.dcm-grid-wrapper {
    transition: opacity 0.2s ease;
}

.dcm-grid-wrapper.dcm-loading {
    opacity: 0.35;
    pointer-events: none;
}

/* ==========================================================================
   GRID
   ========================================================================== */

.dcm-grid {
    display: grid;
    gap: var(--dcm-grid-gap);
}

.dcm-grid-1 { grid-template-columns: 1fr; }
.dcm-grid-2 { grid-template-columns: repeat(2, 1fr); }
.dcm-grid-3 { grid-template-columns: repeat(3, 1fr); }
.dcm-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ==========================================================================
   CARD
   ========================================================================== */

.dcm-card {
    background: var(--dcm-card-bg);
    border: none;
    border-radius: var(--dcm-card-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Card Image */
.dcm-card__image {
    display: block;
    overflow: hidden;
    line-height: 0;
}

.dcm-card__image img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.dcm-card:hover .dcm-card__image img {
    transform: scale(1.03);
}

/* Card Content */
.dcm-card__content {
    padding: 24px 22px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Category Badge */
.dcm-card__categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.dcm-card__badge {
    display: inline-block;
    padding: 5px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    background-color: #1a1a1a;
    letter-spacing: 0.3px;
    border-radius: var(--dcm-badge-radius);
    line-height: 1.4;
}

/* Card Title */
.dcm-card__title {
    font-size: var(--dcm-title-size);
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 10px;
}

.dcm-card__title a {
    color: var(--dcm-title-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.dcm-card__title a:hover {
    color: #444;
}

/* Card Date */
.dcm-card__date {
    font-size: 0.85rem;
    color: var(--dcm-date-color);
    margin-bottom: 14px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dcm-card__date::before {
    content: '';
    display: inline-block;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23777' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

/* Card Excerpt */
.dcm-card__excerpt {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--dcm-excerpt-color);
    margin-bottom: 20px;
    flex: 1;
}

/* Card Read More */
.dcm-card__more {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--dcm-link-color);
    text-decoration: none;
    align-self: flex-start;
    padding-top: 4px;
    transition: color 0.2s ease;
}

.dcm-card__more:hover {
    color: #555;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */

.dcm-pagination {
    margin-top: 40px;
}

.dcm-pagination ul,
.dcm-pagination .page-numbers {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.dcm-pagination li {
    display: inline-block;
}

.dcm-pagination a,
.dcm-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--dcm-title-color);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dcm-pagination a:hover {
    background: #f0f0f0;
}

.dcm-pagination .current {
    background: #1a1a1a;
    color: #ffffff;
    font-weight: 600;
}

.dcm-pagination .dots {
    color: var(--dcm-date-color);
    cursor: default;
}

.dcm-pagination .prev,
.dcm-pagination .next {
    font-weight: 700;
}

/* ==========================================================================
   FILTER
   ========================================================================== */

.dcm-filter {
    margin-bottom: 40px;
}

.dcm-filter__title {
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--dcm-title-color);
    margin: 0 0 20px;
    line-height: 1.3;
}

.dcm-filter__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dcm-filter__item {
    margin-bottom: 14px;
}

.dcm-filter__item:last-child {
    margin-bottom: 0;
}

.dcm-filter__label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    color: #333;
    user-select: none;
    line-height: 1.3;
}

.dcm-filter__label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.dcm-filter__check {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 3px;
    margin-right: 10px;
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dcm-filter__label:hover .dcm-filter__check {
    border-color: #999;
}

.dcm-filter__label input:checked + .dcm-filter__check {
    background: #1a1a1a;
    border-color: #1a1a1a;
}

.dcm-filter__label input:checked + .dcm-filter__check::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.dcm-filter__label input:focus-visible + .dcm-filter__check {
    outline: 2px solid #4A90D9;
    outline-offset: 2px;
}

.dcm-filter__name {
    font-weight: 700;
    line-height: 1.4;
}

.dcm-filter__count {
    font-size: 0.85rem;
    color: #999;
    margin-left: 4px;
}

/* ==========================================================================
   MOBILE FILTER TOGGLE
   ========================================================================== */

.dcm-filter__toggle {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 10px 18px !important;
    background: #1a1a1a !important;
    border: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
    cursor: pointer !important;
    font-size: 0.95rem !important;
    font-weight: 400 !important;
    color: #ffffff !important;
    white-space: normal !important;
    text-align: left !important;
    line-height: 1.3 !important;
    margin-bottom: 16px !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    border-radius: 0 !important;
}

.dcm-filter__toggle:hover,
.dcm-filter__toggle:focus,
.dcm-filter__toggle:active,
.dcm-filter__toggle:visited {
    color: #ffffff !important;
    background: #333 !important;
    box-shadow: none !important;
    outline: none !important;
}

.dcm-filter__toggle,
.dcm-filter__toggle span,
.dcm-filter__toggle svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
    fill: none !important;
}

.dcm-filter__toggle:hover span,
.dcm-filter__toggle:hover svg {
    color: #ffffff !important;
    stroke: #ffffff !important;
}

.dcm-filter__toggle-icon {
    font-size: 0.85rem;
    transform: rotate(180deg);
    transition: transform 0.2s ease;
}

.dcm-filter__toggle[aria-expanded="true"] .dcm-filter__toggle-icon {
    transform: rotate(0deg);
}

.dcm-filter--mobile .dcm-filter__list {
    padding-top: 0;
}

/* ==========================================================================
   LATEST POSTS
   ========================================================================== */

.dcm-latest {
    margin-bottom: 40px;
}

.dcm-latest__title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--dcm-title-color);
    margin: 0 0 20px;
    line-height: 1.3;
}

.dcm-latest__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.dcm-latest__item {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.dcm-latest__item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.dcm-latest__link {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    text-decoration: none;
    color: var(--dcm-title-color);
}

.dcm-latest__link:hover .dcm-latest__name {
    color: #555;
}

.dcm-latest__thumb {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 2px;
}

.dcm-latest__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.dcm-latest__info {
    flex: 1;
    min-width: 0;
}

.dcm-latest__name {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.45;
    display: block;
    transition: color 0.2s ease;
}

/* ==========================================================================
   NO POSTS
   ========================================================================== */

.dcm-no-posts {
    text-align: center;
    padding: 60px 20px;
    color: var(--dcm-date-color);
    font-size: 1rem;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 992px) {
    .dcm-layout {
        flex-direction: column;
    }

    .dcm-sidebar {
        width: 100%;
    }

    .dcm-filter__list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px 20px;
    }

    .dcm-filter__item {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .dcm-grid-2,
    .dcm-grid-3,
    .dcm-grid-4 {
        grid-template-columns: 1fr;
    }

    .dcm-card__title {
        font-size: 1.2rem;
    }

    .dcm-pagination ul,
    .dcm-pagination .page-numbers {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .dcm-card__content {
        padding: 18px 16px;
    }
}
