/**
 * Unicode Books - Premium Frontend Styles
 * Matches Tohed.com Teal & Gold Theme
 * Version: 1.0.1 - Hardcoded colors for better compatibility
 */

/* ============================================
   BASE CONTAINER
   ============================================ */
.unicode-books-page {
    direction: ltr;
    font-family: var(--font-body);
    background: linear-gradient(-180deg, #faf8f3 0%, #f5f2eb 100%);
    min-height: 100vh;
    padding-bottom: 60px;
}

.unicode-books-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================
   HERO COUNTER SECTION
   ============================================ */
.ub-hero {
    background: linear-gradient(-135deg, #1a5f5a 0%, #134845 100%);
    padding: 60px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin-top: 25px;
    margin-bottom: 50px;
    border-radius: 0;
}

/* Islamic geometric pattern overlay */
.ub-hero::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M40 0L80 40L40 80L0 40L40 0z' fill='none' stroke='%23ffffff' stroke-width='0.5' opacity='0.08'/%3E%3Ccircle cx='40' cy='40' r='15' fill='none' stroke='%23c9a227' stroke-width='0.3' opacity='0.12'/%3E%3C/svg%3E");
    background-size: 40px 40px;
    pointer-events: none;
}

/* Radial glow effect */
.ub-hero::after {
    content: '';
    position: absolute;
    top: -50%;
    right: 50%;
    transform: translateX(50%);
    width: 120%;
    height: 200%;
    background: radial-gradient(ellipse at center, rgba(201, 162, 39, 0.15) 0%, transparent 60%);
    pointer-events: none;
}

.ub-hero-content {
    position: relative;
    z-index: 1;
}

.ub-hero-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(201, 162, 39, 0.4);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    backdrop-filter: blur(10px);
}

.ub-hero-icon i {
    font-size: 36px;
    color: #e6c65a;
}

.ub-hero-title {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: normal;
    color: rgba(255, 255, 255, 0.95);
    margin: 0 0 30px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ub-counter-wrapper {
    display: inline-block;
    position: relative;
}

.ub-counter-number {
    font-family: 'Georgia', serif;
    font-size: clamp(72px, 15vw, 120px);
    font-weight: 700;
    color: #c9a227;
    line-height: 1;
    text-shadow:
        0 4px 8px rgba(0, 0, 0, 0.2),
        0 0 60px rgba(201, 162, 39, 0.3);
    position: relative;
    display: inline-block;
}

.ub-counter-number::after {
    content: '';
    position: absolute;
    bottom: -15px;
    right: 50%;
    transform: translateX(50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(-90deg, transparent, #c9a227, transparent);
    border-radius: 2px;
}

.ub-counter-label {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 30px;
}

/* ============================================
   CATEGORY SECTION
   ============================================ */
.ub-category-section {
    margin-bottom: 40px;
}

.ub-category-header {
    background: linear-gradient(-135deg, #1a5f5a 0%, #2a7a74 100%);
    padding: 25px 35px;
    border-radius: 16px 16px 0 0;
    position: relative;
    overflow: hidden;
}

.ub-category-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    background: linear-gradient(-90deg, transparent, rgba(255,255,255,0.1) 50%, transparent);
    pointer-events: none;
}

.ub-category-title {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: normal;
    color: white;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 1;
}

.ub-category-icon {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(201, 162, 39, 0.5);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ub-category-icon i {
    font-size: 20px;
    color: #e6c65a;
}

.ub-category-count {
    background: #c9a227;
    color: #134845;
    font-family: 'Georgia', serif;
    font-size: 14px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
    margin-left: auto;
}

/* ============================================
   BOOKS LIST
   ============================================ */
.ub-books-list {
    background: #fffef9;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 4px 20px rgba(26, 95, 90, 0.1);
    overflow: hidden;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 2-column layout for regular (non-compact) categories on desktop */
@media (min-width: 769px) {
    .ub-category-section:not(.ub-compact-grid) .ub-books-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    /* Vertical divider between columns (RTL: odd items = right column) */
    .ub-category-section:not(.ub-compact-grid) .ub-book-item:nth-child(odd) {
        border-right: 1px solid rgba(26, 95, 90, 0.08);
    }

    /* Remove bottom border from last row */
    .ub-category-section:not(.ub-compact-grid) .ub-book-item:nth-last-child(2):nth-child(odd) {
        border-bottom: none;
    }
}

.ub-book-item {
    border-bottom: 1px solid rgba(26, 95, 90, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ub-book-item:last-child {
    border-bottom: none;
}

.ub-book-item:hover {
    background: linear-gradient(to right, rgba(26, 95, 90, 0.04), transparent 70%);
}

.ub-book-link {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 18px 30px;
    text-decoration: none;
    color: #2c2c2c;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ub-book-link:hover {
    padding-left: 40px;
}

.ub-book-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: linear-gradient(-135deg, #2a7a74 0%, #1a5f5a 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(26, 95, 90, 0.2);
}

.ub-book-item:hover .ub-book-icon {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(26, 95, 90, 0.3);
}

.ub-book-icon i {
    font-size: 14px;
    color: white;
}

.ub-book-content {
    flex: 1;
    min-width: 0;
}

.ub-book-title {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    color: #2c2c2c;
    margin: 0;
    transition: color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.ub-book-item:hover .ub-book-title {
    color: #1a5f5a;
}

/* New Badge */
.ub-badge-new {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(-135deg, #10b981 0%, #059669 100%);
    color: white;
    font-family: sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 6px;
    margin-right: 0;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    animation: ub-pulse-green 2s infinite;
    white-space: nowrap;
    flex-shrink: 0;
}

.ub-badge-new i {
    font-size: 10px;
    color: white;
}

@keyframes ub-pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Arrow indicator on hover */
.ub-book-arrow {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: #f5f2eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 8px;
}

.ub-book-arrow i {
    font-size: 12px;
    color: #1a5f5a;
}

.ub-book-item:hover .ub-book-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   COMPACT GRID LAYOUT (4 columns desktop, 2 mobile)
   ============================================ */
.ub-compact-grid .ub-books-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    padding: 0;
}

.ub-compact-grid .ub-book-item {
    border-bottom: none;
    border-right: 1px solid rgba(26, 95, 90, 0.08);
    border-bottom: 1px solid rgba(26, 95, 90, 0.08);
}

.ub-compact-grid .ub-book-item:nth-child(4n+1) {
    border-right: none;
}

.ub-compact-grid .ub-book-item:nth-child(4n) {
    border-left: none;
}

/* Remove border from last row (4 items) */
.ub-compact-grid .ub-book-item:nth-last-child(-n+4) {
    border-bottom: none;
}

.ub-compact-grid .ub-book-link {
    padding: 16px 20px;
    justify-content: center;
    text-align: center;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 100px;
}

.ub-compact-grid .ub-book-link:hover {
    padding: 16px 20px;
}

.ub-compact-grid .ub-book-icon {
    margin-top: 0;
    width: 36px;
    height: 36px;
}

.ub-compact-grid .ub-book-icon i {
    font-size: 16px;
}

.ub-compact-grid .ub-book-content {
    text-align: center;
}

.ub-compact-grid .ub-book-title {
    font-size: 16px;
    line-height: 1.8;
    text-align: center;
}

.ub-compact-grid .ub-book-arrow {
    display: none;
}

.ub-compact-grid .ub-badge-new {
    display: block;
    margin: 8px 0 0 0;
}

/* ============================================
   STATS FOOTER
   ============================================ */
.ub-stats-footer {
    background: linear-gradient(-135deg, #134845 0%, #1a5f5a 100%);
    padding: 40px 20px;
    margin-top: 50px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: 0;
}

.ub-stats-footer::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(-90deg, #9e7d1a, #c9a227, #e6c65a, #c9a227, #9e7d1a);
}

.ub-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 30px;
    max-width: 600px;
    margin: 0 auto;
}

.ub-stat-item {
    text-align: center;
}

.ub-stat-number {
    font-family: 'Georgia', serif;
    font-size: 36px;
    font-weight: 700;
    color: #c9a227;
    display: block;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ub-stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 5px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.ub-empty-state {
    text-align: center;
    padding: 80px 20px;
    background: #fffef9;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(26, 95, 90, 0.06);
}

.ub-empty-icon {
    width: 100px;
    height: 100px;
    background: #f5f2eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
}

.ub-empty-icon i {
    font-size: 40px;
    color: #8a8a8a;
}

.ub-empty-text {
    font-size: 18px;
    color: #5a5a5a;
    margin: 0;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .ub-hero {
        padding: 40px 15px;
    }

    .ub-hero-title {
        font-size: 22px;
    }

    .ub-counter-number {
        font-size: 72px;
    }

    .ub-category-header {
        padding: 20px 20px;
    }

    .ub-category-title {
        font-size: 20px;
        gap: 12px;
    }

    .ub-category-icon {
        width: 38px;
        height: 38px;
    }

    .ub-book-link {
        padding: 15px 20px;
        gap: 12px;
    }

    .ub-book-link:hover {
        padding-left: 25px;
    }

    .ub-book-icon {
        width: 28px;
        height: 28px;
    }

    .ub-book-icon i {
        font-size: 12px;
    }

    .ub-book-title {
        font-size: 16px;
        line-height: 1.9;
    }

    .ub-book-arrow {
        display: none;
    }

    .ub-hero-icon {
        width: 65px;
        height: 65px;
    }

    .ub-hero-icon i {
        font-size: 28px;
    }

    /* Compact grid: 2 columns on tablet/mobile */
    .ub-compact-grid .ub-books-list {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Reset 4-column borders */
    .ub-compact-grid .ub-book-item:nth-child(4n+1) {
        border-right: 1px solid rgba(26, 95, 90, 0.08);
    }

    .ub-compact-grid .ub-book-item:nth-child(4n) {
        border-left: 1px solid rgba(26, 95, 90, 0.08);
    }

    /* Apply 2-column borders */
    .ub-compact-grid .ub-book-item:nth-child(2n+1) {
        border-right: none;
    }

    .ub-compact-grid .ub-book-item:nth-child(2n) {
        border-left: none;
    }

    .ub-compact-grid .ub-book-item:nth-last-child(-n+2) {
        border-bottom: none;
    }

    .ub-compact-grid .ub-book-link {
        min-height: 90px;
        padding: 14px 15px;
    }

    .ub-compact-grid .ub-book-title {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .ub-category-count {
        display: none;
    }

    .ub-book-link {
        padding: 12px 15px;
    }

    .ub-book-title {
        font-size: 15px;
    }

    .ub-badge-new {
        font-size: 10px;
        padding: 3px 8px;
    }

    /* Compact grid: Keep 2 columns on small mobile */
    .ub-compact-grid .ub-books-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .ub-compact-grid .ub-book-item:last-child {
        border-bottom: none;
    }

    .ub-compact-grid .ub-book-link {
        min-height: 70px;
        padding: 12px 15px;
    }

    .ub-compact-grid .ub-book-icon {
        width: 32px;
        height: 32px;
    }

    .ub-compact-grid .ub-book-icon i {
        font-size: 14px;
    }

    .ub-compact-grid .ub-book-title {
        font-size: 14px;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes ub-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ub-animate-in {
    animation: ub-fade-in-up 0.5s ease forwards;
}

.ub-category-section:nth-child(1) { animation-delay: 0.1s; }
.ub-category-section:nth-child(2) { animation-delay: 0.15s; }
.ub-category-section:nth-child(3) { animation-delay: 0.2s; }
.ub-category-section:nth-child(4) { animation-delay: 0.25s; }
.ub-category-section:nth-child(5) { animation-delay: 0.3s; }
