/**
 * 브랜드 소식 카드 스타일
 * 노션 디자인 시스템 기반
 */

/* 카드 Flex 레이아웃 - 기본값 */
.brand-news-grid {
    display: flex;
    gap: var(--notion-space-5, 20px);
    overflow-x: auto;
    padding: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.brand-news-grid::-webkit-scrollbar {
    display: none;
}

/* 개별 카드 - 노션 스타일 */
.brand-news-card {
    background: var(--notion-bg-default, #ffffff);
    border-radius: var(--notion-radius-md, 6px);
    overflow: hidden;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    min-width: 0;
    width: 100%;
}

.brand-news-card:hover {
    /* 노션 스타일: 미묘한 배경 변화 */
    background: var(--notion-bg-gray-light, #fafafa);
}

/* 카드 헤더 (이제 하단에 위치) - 노션 스타일 */
.brand-news-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--notion-space-3, 12px) 0;
    margin-top: auto;
}

.brand-news-card .company-info {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    margin: 0;
    position: absolute;
    bottom: var(--notion-space-3, 12px);
    left: var(--notion-space-3, 12px);
    z-index: 10;
    width: 40px;
    height: 40px;
}

.brand-news-card .company-logo {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--notion-bg-default, #ffffff);
    box-shadow: var(--notion-shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.08));
    display: block;
    border: 2px solid var(--notion-bg-default, #ffffff);
}

.brand-news-card .company-logo-placeholder {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
    border-radius: 50%;
    background: var(--notion-bg-gray, #f7f6f3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--notion-text-gray, #9b9a97);
    font-size: 16px;
    box-shadow: var(--notion-shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.08));
    flex-shrink: 0;
    border: 2px solid var(--notion-bg-default, #ffffff);
}

.brand-news-card .company-details {
    flex: 1;
    min-width: 0;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
}

.brand-news-card .company-name {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--notion-text-default, #37352f);
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
}

.brand-news-card .company-slogan {
    margin: var(--notion-space-1, 4px) 0 0;
    font-size: 14px;
    color: var(--notion-text-gray, #9b9a97);
    font-style: normal;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
}

/* 카테고리 배지 - 노션 스타일 */
.brand-news-card .news-category {
    padding: var(--notion-space-1, 4px) var(--notion-space-2, 8px);
    border-radius: var(--notion-radius-sm, 4px);
    font-size: var(--notion-text-xs, 11px);
    font-weight: var(--notion-font-medium, 500);
    white-space: nowrap;
}

.news-category.notice {
    background: var(--notion-bg-blue, #e7f3f8);
    color: var(--notion-text-blue, #0b6e99);
}

.news-category.update {
    background: var(--notion-bg-purple, #f3e8ff);
    color: var(--notion-text-purple, #6b21a8);
}

.news-category.event {
    background: var(--notion-bg-orange, #fff4e5);
    color: var(--notion-text-orange, #d9730d);
}

.news-category.promotion {
    background: var(--notion-bg-green, #dbeddb);
    color: var(--notion-text-green, #0f7b0f);
}

.news-category.general {
    background: var(--notion-bg-gray, #f7f6f3);
    color: var(--notion-text-gray, #9b9a97);
}

/* 카드 이미지 - 노션 스타일 */
.brand-news-card .card-image {
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: var(--notion-bg-gray, #f7f6f3);
    border-radius: var(--notion-radius-md, 6px);
    position: relative;
}

.brand-news-card .card-image > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
    border-radius: var(--notion-radius-md, 6px);
}

.brand-news-card:hover .card-image > img {
    transform: scale(1.02);
}

/* 로고는 hover 시 확대하지 않음 */
.brand-news-card .company-logo,
.brand-news-card .company-logo-placeholder {
    transform: none !important;
    transition: none;
}

.brand-news-card:hover .company-logo,
.brand-news-card:hover .company-logo-placeholder {
    transform: none !important;
}

/* 카드 바디 - 노션 스타일 */
.brand-news-card .card-body {
    padding: var(--notion-space-3, 12px) 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.brand-news-card .news-title {
    margin: 0;
    font-size: var(--notion-text-base, 14px);
    font-weight: var(--notion-font-semibold, 600);
    color: var(--notion-text-default, #37352f);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
}

.brand-news-card .news-content {
    margin: 0 0 var(--notion-space-3, 12px);
    font-size: var(--notion-text-sm, 13px);
    color: var(--notion-text-gray, #9b9a97);
    line-height: 1.6;
    flex: 1;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
}

/* 카드 메타 정보 - 노션 스타일 */
.brand-news-card .card-meta {
    display: flex;
    gap: var(--notion-space-4, 16px);
    margin-bottom: var(--notion-space-3, 12px);
    font-size: var(--notion-text-xs, 12px);
    color: var(--notion-text-gray, #9b9a97);
    padding: 0;
    margin-left: 0;
    margin-right: 0;
}

.brand-news-card .card-meta i {
    margin-right: var(--notion-space-1, 4px);
}

/* 카드 링크 - 노션 스타일 */
.brand-news-card .news-link {
    display: inline-flex;
    align-items: center;
    gap: var(--notion-space-2, 6px);
    color: var(--notion-text-blue, #0b6e99);
    text-decoration: none;
    font-size: var(--notion-text-sm, 13px);
    font-weight: var(--notion-font-medium, 500);
    transition: opacity 0.15s ease;
}

.brand-news-card .news-link:hover {
    opacity: 0.8;
}

.brand-news-card .news-link i {
    font-size: 11px;
}

/* 카드 푸터 - 노션 스타일 */
.brand-news-card .card-footer {
    padding: var(--notion-space-3, 12px) var(--notion-space-4, 16px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.brand-news-card .btn-card-action {
    padding: var(--notion-space-2, 6px) var(--notion-space-3, 12px);
    background: var(--notion-text-default, #37352f);
    color: var(--notion-bg-default, #ffffff);
    border: none;
    border-radius: var(--notion-radius-md, 6px);
    font-size: var(--notion-text-xs, 12px);
    font-weight: var(--notion-font-medium, 500);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--notion-space-2, 6px);
    transition: opacity 0.15s ease;
}

.brand-news-card .btn-card-action:hover {
    opacity: 0.85;
}

.brand-news-card .importance-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--notion-space-1, 4px);
    padding: var(--notion-space-1, 4px) var(--notion-space-2, 8px);
    border-radius: var(--notion-radius-sm, 4px);
    font-size: var(--notion-text-xs, 11px);
    font-weight: var(--notion-font-medium, 500);
}

.brand-news-card .importance-indicator.high {
    background: var(--notion-bg-red, #fbe4e4);
    color: var(--notion-text-red, #e03e3e);
}

/* 빈 상태 메시지 - 노션 스타일 */
.no-news-message {
    text-align: center;
    padding: var(--notion-space-8, 60px) var(--notion-space-5, 20px);
    color: var(--notion-text-gray, #9b9a97);
}

.no-news-message i {
    font-size: 48px;
    margin-bottom: var(--notion-space-4, 16px);
}

.no-news-message p {
    font-size: var(--notion-text-sm, 14px);
    margin: 0;
}

/* 모달 스타일 - 노션 스타일 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--notion-space-5, 20px);
}

.brand-news-modal {
    background: var(--notion-bg-default, #ffffff);
    border-radius: var(--notion-radius-lg, 8px);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--notion-border-default, #e9e9e7);
    box-shadow: var(--notion-shadow-lg, 0 20px 25px -5px rgba(0, 0, 0, 0.1));
}

.brand-news-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--notion-space-5, 20px);
    border-bottom: 1px solid var(--notion-border-light, #f1f1ef);
}

.modal-company-info {
    display: flex;
    align-items: center;
    gap: var(--notion-space-3, 12px);
}

.modal-company-logo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--notion-bg-default, #ffffff);
}

.modal-company-logo-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--notion-bg-gray, #f7f6f3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--notion-text-gray, #9b9a97);
    font-size: 20px;
}

.modal-company-info h3 {
    margin: 0;
    font-size: var(--notion-text-lg, 16px);
    font-weight: var(--notion-font-semibold, 600);
    color: var(--notion-text-default, #37352f);
}

.modal-company-slogan {
    margin: var(--notion-space-1, 4px) 0 0;
    font-size: var(--notion-text-xs, 12px);
    color: var(--notion-text-gray, #9b9a97);
    font-style: italic;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--notion-bg-gray, #f7f6f3);
    border-radius: var(--notion-radius-sm, 4px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--notion-text-gray, #9b9a97);
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: var(--notion-bg-gray-hover, #e9e9e7);
    color: var(--notion-text-default, #37352f);
}

.brand-news-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--notion-space-6, 24px);
}

.modal-image {
    width: 100%;
    max-height: 400px;
    margin-bottom: var(--notion-space-6, 24px);
    border-radius: var(--notion-radius-md, 6px);
    overflow: hidden;
}

.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-news-header {
    display: flex;
    gap: var(--notion-space-3, 12px);
    align-items: center;
    margin-bottom: var(--notion-space-4, 16px);
}

.modal-category {
    padding: var(--notion-space-2, 6px) var(--notion-space-3, 12px);
    border-radius: var(--notion-radius-sm, 4px);
    font-size: var(--notion-text-xs, 12px);
    font-weight: var(--notion-font-medium, 500);
}

.modal-importance {
    display: inline-flex;
    align-items: center;
    gap: var(--notion-space-1, 4px);
    padding: var(--notion-space-2, 6px) var(--notion-space-3, 12px);
    border-radius: var(--notion-radius-sm, 4px);
    font-size: var(--notion-text-xs, 12px);
    font-weight: var(--notion-font-medium, 500);
}

.modal-importance.high {
    background: var(--notion-bg-red, #fbe4e4);
    color: var(--notion-text-red, #e03e3e);
}

.modal-title {
    margin: 0 0 var(--notion-space-4, 16px);
    font-size: var(--notion-text-2xl, 24px);
    font-weight: var(--notion-font-bold, 700);
    color: var(--notion-text-default, #37352f);
    line-height: 1.3;
}

.modal-meta {
    display: flex;
    gap: var(--notion-space-5, 20px);
    margin-bottom: var(--notion-space-6, 24px);
    font-size: var(--notion-text-sm, 13px);
    color: var(--notion-text-gray, #9b9a97);
}

.modal-meta span {
    display: inline-flex;
    align-items: center;
    gap: var(--notion-space-2, 6px);
}

.modal-content-text {
    font-size: var(--notion-text-base, 15px);
    line-height: 1.8;
    color: var(--notion-text-default, #37352f);
    margin-bottom: var(--notion-space-6, 24px);
}

.modal-link-section {
    padding-top: var(--notion-space-5, 20px);
    border-top: 1px solid var(--notion-border-light, #f1f1ef);
    margin-bottom: var(--notion-space-4, 16px);
}

.modal-external-link {
    display: inline-flex;
    align-items: center;
    gap: var(--notion-space-2, 8px);
    padding: var(--notion-space-3, 10px) var(--notion-space-4, 16px);
    background: var(--notion-text-blue, #0b6e99);
    color: var(--notion-bg-default, #ffffff);
    text-decoration: none;
    border-radius: var(--notion-radius-md, 6px);
    font-size: var(--notion-text-sm, 14px);
    font-weight: var(--notion-font-medium, 500);
    transition: opacity 0.15s ease;
}

.modal-external-link:hover {
    opacity: 0.85;
}

.modal-company-link {
    margin-top: var(--notion-space-3, 12px);
}

.modal-company-link a {
    display: inline-flex;
    align-items: center;
    gap: var(--notion-space-2, 6px);
    color: var(--notion-text-gray, #9b9a97);
    text-decoration: none;
    font-size: var(--notion-text-sm, 13px);
    transition: color 0.15s ease;
}

.modal-company-link a:hover {
    color: var(--notion-text-blue, #0b6e99);
}

/* 반응형 디자인 */

/* Mobile - 가로 스크롤 (카드가 살짝 잘려 스크롤 유도) */
@media (max-width: 768px) {
    .brand-news-grid {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        flex-wrap: nowrap;
        /* index.css의 .brand-updates-container에서 margin-left: -16px 처리됨 */
        /* 여기서는 margin-left 설정하지 않음 (중복 방지) */
        padding-right: 16px;
        scrollbar-width: none;
        -ms-overflow-style: none;
        /* scroll-snap 제거 - 초기 자동 스크롤 방지 */
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    .brand-news-grid::-webkit-scrollbar {
        display: none;
    }

    .brand-news-card {
        flex: 0 0 42%;
        max-width: 42%;
        min-width: 42%;
        width: 42%;
        /* scroll-snap-align 제거 */
    }

    /* 첫 번째 카드에 좌측 마진 - 타이틀과 시작점 정렬 */
    /* index.css의 .brand-updates-container > *:first-child 에서 이미 처리됨 */

    .brand-news-modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-overlay {
        padding: 0;
    }
}

/* Tablet - 3개 카드 표시 */
@media (min-width: 769px) and (max-width: 1023px) {
    .brand-news-grid {
        display: flex;
        overflow-x: visible;
        flex-wrap: nowrap;
        gap: 20px;
        width: 100%;
    }

    .brand-news-card {
        flex: 0 0 calc((100% - 40px) / 3);
        max-width: calc((100% - 40px) / 3);
        min-width: 0;
        width: calc((100% - 40px) / 3);
    }

    .brand-news-card:nth-child(n+4) {
        display: none;
    }
}

/* Desktop - 5개 카드 표시 */
@media (min-width: 1024px) and (max-width: 1919px) {
    .brand-news-grid {
        display: flex;
        overflow-x: visible;
        flex-wrap: nowrap;
        gap: 20px;
        width: 100%;
    }

    .brand-news-card {
        flex: 0 0 calc((100% - 80px) / 5);
        max-width: calc((100% - 80px) / 5);
        min-width: 0;
        width: calc((100% - 80px) / 5);
    }

    /* 6번째 카드부터 숨김 */
    .brand-news-card:nth-child(n+6) {
        display: none;
    }
}

/* Wide Desktop (1920px 이상) - 6개 카드 표시 */
@media (min-width: 1920px) {
    .brand-news-grid {
        display: flex;
        overflow-x: visible;
        flex-wrap: nowrap;
        gap: 20px;
        width: 100%;
    }

    .brand-news-card {
        flex: 0 0 calc((100% - 100px) / 6);
        max-width: calc((100% - 100px) / 6);
        min-width: 0;
        width: calc((100% - 100px) / 6);
    }

    /* 7번째 카드부터 숨김 */
    .brand-news-card:nth-child(n+7) {
        display: none;
    }
}

/* 브랜드 뉴스 스켈레톤 카드 */
.bn-skeleton-card {
    background: var(--notion-bg-default, #ffffff);
    border-radius: var(--notion-radius-md, 6px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 쉬머 효과 애니메이션 - 왼쪽에서 오른쪽으로 이동 */
@keyframes bn-shimmer-sweep {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.bn-skeleton-image {
    width: 100%;
    aspect-ratio: 3 / 4;
    /* 고정된 회색 배경 */
    background: var(--notion-bg-gray, #f7f6f3) !important;
    border-radius: var(--notion-radius-md, 6px);
    position: relative;
    overflow: hidden;
}

/* 쉬머 효과 - ::after로 분리하여 배경 위를 지나감 */
.bn-skeleton-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    animation: bn-shimmer-sweep 1.5s ease-in-out infinite;
}

.bn-skeleton-body {
    padding: var(--notion-space-3, 12px) 0;
    display: flex;
    flex-direction: column;
    gap: var(--notion-space-2, 8px);
}

.bn-skeleton-text {
    height: 12px;
    /* 고정된 회색 배경 */
    background: var(--notion-bg-gray, #f7f6f3);
    border-radius: var(--notion-radius-sm, 4px);
    position: relative;
    overflow: hidden;
}

/* 텍스트 스켈레톤에도 쉬머 효과 */
.bn-skeleton-text::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    animation: bn-shimmer-sweep 1.5s ease-in-out infinite;
}

.bn-skeleton-title {
    width: 80%;
    height: 14px;
}

.bn-skeleton-subtitle {
    width: 60%;
    height: 12px;
}

/* 에러 상태 UI - 노션 스타일 */
.error-state {
    text-align: center;
    padding: var(--notion-space-8, 60px) var(--notion-space-5, 20px);
    background: var(--notion-bg-red, #fbe4e4);
    border-radius: var(--notion-radius-lg, 8px);
    width: 100%;
}

.error-icon {
    font-size: 48px;
    color: var(--notion-text-red, #e03e3e);
    margin-bottom: var(--notion-space-4, 16px);
}

.error-title {
    margin: 0 0 var(--notion-space-2, 8px);
    font-size: var(--notion-text-lg, 18px);
    font-weight: var(--notion-font-semibold, 600);
    color: var(--notion-text-default, #37352f);
}

.error-message {
    margin: 0 0 var(--notion-space-5, 20px);
    font-size: var(--notion-text-sm, 14px);
    color: var(--notion-text-gray, #9b9a97);
    line-height: 1.6;
}

.retry-button {
    padding: var(--notion-space-3, 10px) var(--notion-space-5, 20px);
    background: var(--notion-text-red, #e03e3e);
    color: var(--notion-bg-default, #ffffff);
    border: none;
    border-radius: var(--notion-radius-md, 6px);
    font-size: var(--notion-text-sm, 14px);
    font-weight: var(--notion-font-medium, 500);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--notion-space-2, 8px);
    transition: opacity 0.15s ease;
}

.retry-button:hover {
    opacity: 0.85;
}

.retry-button:active {
    transform: scale(0.98);
}

/* 브랜드 뉴스 로딩 상태 컨테이너 - 노션 스타일 */
.brand-news-loading {
    display: flex;
    gap: var(--notion-space-4, 16px);
    width: 100%;
    overflow: hidden;
}

@media (max-width: 768px) {
    .brand-news-loading {
        gap: 10px;
        /* 컨테이너를 왼쪽 끝까지 확장 - 스크롤 시 여백 없이 이동 */
        margin-left: -16px;
        width: calc(100% + 16px);
        padding-right: 16px;
    }

    .brand-news-loading .bn-skeleton-card {
        flex: 0 0 42%;
        max-width: 42%;
        min-width: 42%;
    }

    /* 첫 번째 스켈레톤 카드에 좌측 마진 */
    .brand-news-loading .bn-skeleton-card:first-of-type {
        margin-left: 16px;
    }
}

@media (min-width: 769px) and (max-width: 1023px) {
    .brand-news-loading .bn-skeleton-card {
        flex: 0 0 calc((100% - 40px) / 3);
        max-width: calc((100% - 40px) / 3);
    }
}

@media (min-width: 1024px) and (max-width: 1919px) {
    .brand-news-loading .bn-skeleton-card {
        flex: 0 0 calc((100% - 80px) / 5);
        max-width: calc((100% - 80px) / 5);
    }
}

@media (min-width: 1920px) {
    .brand-news-loading .bn-skeleton-card {
        flex: 0 0 calc((100% - 100px) / 6);
        max-width: calc((100% - 100px) / 6);
    }
}