/* ============================================================
   META AD FORM - CSS
   Page: page-meta-ad-form.html
   ============================================================ */

/* ========================
   MODE SELECTION CARDS
   ======================== */
.mode-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
    border: 2px solid #e7e7e8;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    position: relative;
    overflow: hidden;
}

.mode-card:hover {
    border-color: #7367f0;
    box-shadow: 0 4px 18px rgba(115, 103, 240, 0.15);
    transform: translateY(-2px);
}

.mode-card:active {
    transform: translateY(0);
}

.mode-card-icon {
    width: 64px;
    height: 64px;
    min-width: 64px;
    border-radius: 12px;
    background: linear-gradient(135deg, #7367f0 0%, #9e95f5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.75rem;
}

.mode-card-icon.batch {
    background: linear-gradient(135deg, #28c76f 0%, #48da89 100%);
}

.mode-card-content {
    flex: 1;
}

.mode-card-title {
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.mode-card-description {
    color: #6f6b7d;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.mode-card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.mode-card-features span {
    font-size: 0.75rem;
    color: #28c76f;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
}

.mode-card-arrow {
    font-size: 1.5rem;
    color: #d5d5d8;
    transition: all 0.3s ease;
}

.mode-card:hover .mode-card-arrow {
    color: #7367f0;
    transform: translateX(4px);
}

/* ========================
   BATCH LOT CARDS
   ======================== */
.batch-lot-card {
    border: 2px solid #e7e7e8;
    border-radius: 10px;
    padding: 1rem;
    transition: all 0.25s ease;
    background: #fff;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.batch-lot-card:hover {
    border-color: #7367f0;
    box-shadow: 0 2px 8px rgba(115, 103, 240, 0.12);
}

.batch-lot-card.selected {
    border-color: #7367f0;
    background: rgba(115, 103, 240, 0.04);
}

.batch-lot-card.selected::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #7367f0, #9e95f5);
    border-radius: 10px 10px 0 0;
}

.batch-lot-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    min-width: 0;
}

.batch-lot-header .form-check {
    margin: 0;
    flex-shrink: 0;
}

.batch-lot-number {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #7367f0;
    background: rgba(115, 103, 240, 0.08);
    padding: 0.15rem 0.5rem;
    border-radius: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.batch-lot-status {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 5px;
    white-space: nowrap;
    margin-left: auto;
    overflow: hidden;
    text-overflow: ellipsis;
}

.batch-lot-status.active {
    color: #28c76f;
    background: rgba(40, 199, 111, 0.1);
}

.batch-lot-status.inactive {
    color: #ea5455;
    background: rgba(234, 84, 85, 0.1);
}

.batch-lot-description {
    font-size: 0.8125rem;
    color: #6f6b7d;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.3em;
}

.batch-lot-values {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.batch-lot-value {
    font-size: 0.75rem;
    min-width: 0;
}

.batch-lot-value-label {
    color: #a5a3ae;
    display: block;
    margin-bottom: 1px;
}

.batch-lot-value-amount {
    color: #5d596c;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.batch-lot-region {
    font-size: 0.75rem;
    color: #a5a3ae;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.batch-lot-category {
    margin-top: 0.5rem;
}

.batch-lot-category-badge {
    cursor: pointer;
    font-size: 0.7rem;
    transition: opacity 0.15s;
}

.batch-lot-category-badge:hover {
    opacity: 0.8;
}

/* Batch loading animation */
.batch-loading .spinner-border {
    width: 2.5rem;
    height: 2.5rem;
}

/* Skeleton loading cards */
.skeleton-card {
    pointer-events: none;
    min-height: 140px;
}

.skeleton-line {
    background: linear-gradient(90deg, #e7e7e8 25%, #f0f0f1 50%, #e7e7e8 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-header {
    height: 14px;
    width: 50%;
    margin-bottom: 12px;
}

.skeleton-desc {
    height: 10px;
    width: 100%;
    margin-bottom: 6px;
}

.skeleton-desc-short {
    height: 10px;
    width: 65%;
    margin-bottom: 16px;
}

.skeleton-label {
    height: 8px;
    width: 56px;
    margin-bottom: 4px;
}

.skeleton-value {
    height: 12px;
    width: 72px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Skeleton overlay for cards loading template */
.batch-lot-card.loading-template {
    pointer-events: none;
    position: relative;
    overflow: hidden;
    min-height: 180px;
}

.batch-lot-card.loading-template > * {
    opacity: 0;
}

.batch-lot-card.loading-template::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    border-radius: 10px;
    background:
        /* header line */
        linear-gradient(#e7e7e8, #e7e7e8) 1rem 1rem / 45% 14px no-repeat,
        /* desc line 1 */
        linear-gradient(#e7e7e8, #e7e7e8) 1rem 2.5rem / 100% 10px no-repeat,
        /* desc line 2 */
        linear-gradient(#e7e7e8, #e7e7e8) 1rem 3.25rem / 65% 10px no-repeat,
        /* value label 1 */
        linear-gradient(#e7e7e8, #e7e7e8) 1rem calc(100% - 2.5rem) / 56px 8px no-repeat,
        /* value amount 1 */
        linear-gradient(#e7e7e8, #e7e7e8) 1rem calc(100% - 1.5rem) / 72px 12px no-repeat,
        /* value label 2 */
        linear-gradient(#e7e7e8, #e7e7e8) calc(1rem + 88px) calc(100% - 2.5rem) / 56px 8px no-repeat,
        /* value amount 2 */
        linear-gradient(#e7e7e8, #e7e7e8) calc(1rem + 88px) calc(100% - 1.5rem) / 72px 12px no-repeat,
        /* bg */
        #fff;
}

.batch-lot-card.loading-template::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 4;
    border-radius: 10px;
    background: linear-gradient(90deg, transparent 25%, rgba(255,255,255,0.6) 50%, transparent 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* ========================
   INDIVIDUAL FORM ENHANCEMENTS
   ======================== */
#individualInfoCard .form-label {
    font-weight: 500;
    font-size: 0.8125rem;
}

#individualImagePreview {
    border: 1px solid #e7e7e8;
    border-radius: 8px;
}

/* ========================
   GENERAL
   ======================== */
.btn-label-primary {
    transition: all 0.2s ease;
}

/* ========================
   DARK MODE
   ======================== */
.dark-style .mode-card {
    background: #2f3349;
    border-color: #434968;
}

.dark-style .mode-card:hover {
    border-color: #7367f0;
    box-shadow: 0 4px 18px rgba(115, 103, 240, 0.25);
}

.dark-style .mode-card-description {
    color: #b6bee3;
}

.dark-style .mode-card-arrow {
    color: #434968;
}

.dark-style .batch-lot-card {
    background: #2f3349;
    border-color: #434968;
}

.dark-style .batch-lot-card:hover {
    border-color: #7367f0;
}

.dark-style .batch-lot-card.selected {
    background: rgba(115, 103, 240, 0.08);
    border-color: #7367f0;
}

.dark-style .batch-lot-description {
    color: #b6bee3;
}

.dark-style .skeleton-line {
    background: linear-gradient(90deg, #434968 25%, #4e5578 50%, #434968 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.dark-style .batch-lot-card.loading-template::before {
    background:
        linear-gradient(#434968, #434968) 1rem 1rem / 45% 14px no-repeat,
        linear-gradient(#434968, #434968) 1rem 2.5rem / 100% 10px no-repeat,
        linear-gradient(#434968, #434968) 1rem 3.25rem / 65% 10px no-repeat,
        linear-gradient(#434968, #434968) 1rem calc(100% - 2.5rem) / 56px 8px no-repeat,
        linear-gradient(#434968, #434968) 1rem calc(100% - 1.5rem) / 72px 12px no-repeat,
        linear-gradient(#434968, #434968) calc(1rem + 88px) calc(100% - 2.5rem) / 56px 8px no-repeat,
        linear-gradient(#434968, #434968) calc(1rem + 88px) calc(100% - 1.5rem) / 72px 12px no-repeat,
        #2f3349;
}

.dark-style .batch-lot-card.loading-template::after {
    background: linear-gradient(90deg, transparent 25%, rgba(47,51,73,0.6) 50%, transparent 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.dark-style .batch-lot-value-amount {
    color: #cfd3ec;
}

.dark-style .batch-lot-value-label,
.dark-style .batch-lot-region {
    color: #7983bb;
}

.dark-style #individualImagePreview {
    border-color: #434968;
}

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 767.98px) {
    .mode-card {
        flex-direction: column;
        text-align: center;
    }

    .mode-card-arrow {
        display: none;
    }

    .mode-card-features {
        justify-content: center;
    }

    .batch-lot-values {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* ========================
   PREVIEW MODAL
   ======================== */
#publicationPreviewModal .modal-header {
    border-bottom: 1px solid #e7e7e8;
}

#publicationPreviewModal .modal-footer {
    border-top: 1px solid #e7e7e8;
}

.preview-page-indicator {
    font-size: 0.75rem;
    font-weight: 600;
}

.preview-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f9;
    padding: 1.5rem;
    min-height: 400px;
}

.preview-frame-wrapper {
    width: 540px;
    height: 540px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    background: #fff;
    position: relative;
}

.preview-frame {
    width: 1080px;
    height: 1080px;
    border: none;
    transform: scale(0.5);
    transform-origin: 0 0;
    pointer-events: none;
}

.preview-loading,
.preview-error {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ========================
   PREVIEW DESCRIPTION
   ======================== */
.preview-description-container {
    border-top: 1px solid #e7e7e8;
    margin: 0;
}

.preview-description-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #5d596c;
    background: #f8f7fa;
    border-bottom: 1px solid #e7e7e8;
}

.preview-description-header .ti {
    color: #7367f0;
}

.preview-description-text {
    margin: 0;
    padding: 1rem 1.25rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.8125rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    color: #5d596c;
    background: #fff;
    border: none;
    max-height: 200px;
    overflow-y: auto;
}

/* ========================
   BATCH LOT THUMBNAILS
   ======================== */
.batch-lot-thumbnail {
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: #f5f5f9;
    position: relative;
}

.preview-thumbnail-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.preview-thumbnail-frame {
    width: 1080px;
    height: 1080px;
    border: none;
    transform-origin: 0 0;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
}

/* Scale is applied dynamically via JS based on container width */

.preview-thumbnail-loading {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-thumbnail-error {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a5a3ae;
    font-size: 1.5rem;
}

/* ========================
   BATCH VALIDATION BADGES
   ======================== */
.batch-lot-validation-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(255, 159, 67, 0.12);
    color: #ff9f43;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: help;
    transition: all 0.2s ease;
}

.batch-lot-validation-badge:hover {
    background: rgba(255, 159, 67, 0.2);
}

.batch-lot-validation-badge .ti {
    font-size: 0.9375rem;
}

.batch-lot-validation-count {
    line-height: 1;
}

.batch-lot-preview-ready {
    position: absolute;
    bottom: 8px;
    right: 8px;
    z-index: 2;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #28c76f;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* ========================
   PREVIEW DARK MODE
   ======================== */
.dark-style .preview-container {
    background: #25293c;
}

.dark-style .preview-frame-wrapper {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.dark-style .batch-lot-thumbnail {
    background: #25293c;
}

.dark-style #publicationPreviewModal .modal-header,
.dark-style #publicationPreviewModal .modal-footer {
    border-color: #434968;
}

.dark-style .preview-thumbnail-error {
    color: #7983bb;
}

.dark-style .preview-description-container {
    border-color: #434968;
}

.dark-style .preview-description-header {
    background: #2f3349;
    color: #b6bee3;
    border-color: #434968;
}

.dark-style .preview-description-text {
    background: #25293c;
    color: #b6bee3;
}

/* ========================
   PREVIEW RESPONSIVE
   ======================== */
@media (max-width: 767.98px) {
    .preview-frame-wrapper {
        width: 300px;
        height: 300px;
    }

    .preview-frame {
        transform: scale(0.278);
    }

    .batch-lot-thumbnail {
        max-height: 200px;
    }
}
