/* Ẩn Bớt Nội Dung - Frontend Styles */

.abnd-container {
    position: relative;
    margin: 20px 0;
    transition: all 0.3s ease;
}

.abnd-content {
    position: relative;
    overflow: hidden;
    max-height: 9em; /* Default 4 lines */
    line-height: 1.5em;
    transition: max-height 0.5s ease-in-out;
}

.abnd-container[data-lines="2"] .abnd-content {
    max-height: 4.5em; /* 2 lines */
}

.abnd-container[data-lines="3"] .abnd-content {
    max-height: 6.75em; /* 3 lines */
}

.abnd-container[data-lines="4"] .abnd-content {
    max-height: 9em; /* 4 lines */
}

.abnd-container[data-lines="5"] .abnd-content {
    max-height: 11.25em; /* 5 lines */
}

.abnd-text {
    padding-bottom: 20px;
}

/* Gradient fade effect */
.abnd-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.7) 30%,
        rgba(255, 255, 255, 0.9) 60%,
        rgba(255, 255, 255, 1) 100%
    );
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Dark mode support */
body.dark-mode .abnd-fade,
body.wp-dark-mode .abnd-fade,
[data-theme="dark"] .abnd-fade {
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.7) 30%,
        rgba(0, 0, 0, 0.9) 60%,
        rgba(0, 0, 0, 1) 100%
    );
}

/* Toggle button styles */
.abnd-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 10px auto 0;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.abnd-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.abnd-toggle-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}

/* Button icon */
.abnd-btn-icon {
    font-size: 20px;
    line-height: 1;
    transition: transform 0.3s ease;
    display: inline-block;
}

/* Button text */
.abnd-btn-text {
    font-size: 16px;
    line-height: 1;
}

/* Expanded state */
.abnd-container.expanded .abnd-content {
    max-height: none !important;
}

.abnd-container.expanded .abnd-fade {
    opacity: 0;
    visibility: hidden;
}

.abnd-container.expanded .abnd-btn-icon {
    transform: rotate(180deg);
}

/* Ripple effect on button click */
.abnd-toggle-btn::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.abnd-toggle-btn:active::before {
    width: 200px;
    height: 200px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .abnd-toggle-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .abnd-btn-icon {
        font-size: 18px;
    }
    
    .abnd-btn-text {
        font-size: 14px;
    }
}

/* Print styles */
@media print {
    .abnd-container .abnd-content {
        max-height: none !important;
    }
    
    .abnd-fade,
    .abnd-toggle-btn {
        display: none !important;
    }
}

/* Accessibility */
.abnd-toggle-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.abnd-toggle-btn:focus:not(:focus-visible) {
    outline: none;
}

/* Loading state */
.abnd-container.loading .abnd-toggle-btn {
    opacity: 0.7;
    pointer-events: none;
}

.abnd-container.loading .abnd-toggle-btn::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: abnd-spin 1s linear infinite;
}

@keyframes abnd-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Multiple containers spacing */
.abnd-container + .abnd-container {
    margin-top: 30px;
}

/* Custom background compatibility */
.has-background .abnd-fade {
    background: inherit;
    position: relative;
}

.has-background .abnd-fade::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        currentColor 100%
    );
    opacity: 0.9;
}