/* UPDATED: 2024-01-14 - Flip button moved to bottom right - VERSION 3 - WITH !IMPORTANT */
body, html {
    height: 100%;
    background: #f3f4f6;
    overflow-x: hidden;
}

/* ===================================
   MAIN CONTAINER
   =================================== */
.edi-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 10px 0;
    min-height: 90vh;
}

/* ===================================
   NAVIGATION BUTTONS & COUNTERS
   =================================== */
.nav-buttons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 0;
    gap: 20px;
    flex-shrink: 0;
}

.nav-button {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
    background: linear-gradient(135deg, #0056b3, #003d82);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.nav-button:active {
    transform: translateY(0);
}

.nav-counter {
    background: white;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    color: #666;
    font-weight: 600;
    font-size: 16px;
    min-width: 80px;
    text-align: center;
}

/* ===================================
   CARD ROW & CARD ITEMS
   =================================== */
.card-row {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding: 1rem 2rem;
    gap: 20px;
    width: 100%;
    flex: 1;
    min-height: 50vh;
    align-items: center;
    justify-content: flex-start;
}

.card-row::-webkit-scrollbar {
    display: none;
}

.card-item {
    flex: 0 0 auto;
    width: 50vh;
    height: auto;
    aspect-ratio: 0.65 / 1;
    transition: transform 0.3s;
}

/* ===================================
   CARD STYLING
   =================================== */
.card {
    height: 100%;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
    background: white;
    display: flex;
    flex-direction: column;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

.card-body {
    flex: 1;
    overflow-y: auto;
    padding: clamp(0.5rem, 1.5vh, 1rem);
    display: flex;
    flex-direction: column;
}

.clickable-card {
    cursor: pointer;
}

/* ===================================
   FLIP CARD STYLES
   =================================== */
.flip-card {
    background-color: transparent;
    width: 100%;
    height: 100%;
    perspective: 1000px;
    position: relative;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 30px;
    background-size: cover;
    background-position: center;
    top: 0;
    left: 0;
    overflow: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* ===================================
   VIDEO & AUDIO CARD CONTENT
   =================================== */
.card-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* ===================================
   AUDIO CARD OVERLAY STYLES
   =================================== */
.audio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1; /* Same as video, below buttons */
}

.audio-player-container {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 300px;
    max-width: 90%;
}

.audio-label {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.audio-player {
    width: 100%;
    height: 54px;
    border-radius: 27px;
    outline: none;
}

/* Individual Card Modal Audio */
.modal-audio-card {
    width: 620px;
    height: 880px;
    max-width: 90%;
    max-height: 85vh;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Ensure the inner wrapper is properly displayed */
.modal-audio-card > div {
    width: 100%;
    height: 100%;
}

.audio-card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 2rem;
}

.audio-card-icon {
    font-size: clamp(3rem, 8vh, 6rem) !important;
    color: white !important;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.audio-card-player {
    width: 100%;
    max-width: 400px;
    padding: 0 1rem;
}

.audio-card-player audio {
    width: 100% !important;
    height: 40px;
    border-radius: 20px;
}

.individual-audio-container {
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 40px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 30px;
    min-width: 400px;
    max-width: 90%;
}

.individual-audio-label {
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.individual-audio-player {
    width: 100%;
    height: 60px;
    border-radius: 30px;
    outline: none;
}

/* ===================================
   CARD BUTTONS & ICONS
   =================================== */

/* Expand Icon (Top Right) */
.expand-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.expand-icon:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.expand-icon i {
    font-size: 16px;
}

/* Expand Back Button (Top Left on back side) */
.expand-back-button {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    font-size: 14px;
    padding: 0;
}

.expand-back-button:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.expand-back-button i {
    font-size: 16px;
}

/* Conversation Prompt Button (Bottom Center) */
.conversation-prompt-btn {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: #ffc107;
    border: none;
    border-radius: 25px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.conversation-prompt-btn:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.conversation-prompt-btn i {
    margin-right: 8px;
    color: #ffc107;
}

.conversation-prompt-btn span {
    color: white;
}

/* Flip Back Button (Bottom Right on back side) */
.flip-back-btn {
    position: absolute !important;
    bottom: 15px !important;
    right: 15px !important;
    left: auto !important; /* Override any left positioning */
    transform: none !important; /* Override any transforms */
    background-color: rgba(255, 193, 7, 0.9);
    color: #000;
    border: none;
    border-radius: 25px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.flip-back-btn:hover {
    background-color: #ffc107;
    transform: scale(1.05) !important;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.flip-back-btn i {
    margin-right: 8px;
}

/* ===================================
   FLOATING SEE MORE BUTTON
   =================================== */
.floating-see-more {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    border-radius: 50px;
    padding: 15px 25px;
    color: white;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.floating-see-more:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 123, 255, 0.4);
    background: linear-gradient(135deg, #0056b3, #003d82);
}

.floating-see-more i {
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.floating-see-more:hover i {
    transform: translateX(3px);
}

/* ===================================
   MODAL STYLES
   =================================== */
.modal-xl-custom {
    max-width: 90vw;
}

.modal-content-custom {
    border-radius: 15px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header-custom {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border-radius: 15px 15px 0 0;
    padding: 20px 30px;
}

.modal-title-custom {
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-body-custom {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
    position: relative;
}

.modal-footer-custom {
    border-top: none;
    padding: 20px 30px;
    background-color: #f8f9fa;
    border-radius: 0 0 15px 15px;
}

.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ===================================
   MODAL CARD CAROUSEL
   =================================== */
.modal-card-row {
    display: flex !important;
    overflow-x: auto !important;
    scroll-behavior: smooth !important;
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
    padding: 20px 30px 60px 30px !important;
    gap: 20px !important;
    width: 100%;
    min-height: 400px !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

.modal-card-row::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.modal-card-item {
    flex: 0 0 auto;
    width: 30vh;
    height: auto;
    aspect-ratio: 0.65 / 1;
    transition: transform 0.3s;
    margin: 0 10px;
}

.modal-card {
    height: 100%;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: rgba(0, 0, 0, 0.25) 0px 3px 10px;
    background: white;
    display: flex;
    flex-direction: column;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    position: relative;
}

/* Modal Navigation */
.modal-nav-buttons-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 0;
    gap: 15px;
}

.modal-nav-button {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(0, 123, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-nav-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.4);
    background: linear-gradient(135deg, #0056b3, #003d82);
}

.modal-nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.2);
}

.modal-nav-counter {
    background: white;
    padding: 6px 12px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: #666;
    font-weight: 600;
    font-size: 14px;
    min-width: 60px;
    text-align: center;
}

/* Modal Flip Card Styles */
.modal-flip-card {
    position: relative;
    width: 100%;
    height: 100%;
}

.modal-flip-card .flip-card-inner {
    position: relative;
    transform-style: preserve-3d;
}

.modal-flip-card .flip-card-front,
.modal-flip-card .flip-card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ===================================
   INDIVIDUAL CARD MODAL (FULLSCREEN)
   =================================== */
.individual-card-container {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
}

.modal-flip-container {
    position: relative;
    width: 100%;
    height: 100%;
    perspective: 1000px;
}

.modal-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.modal-flip-container.flipped .modal-flip-inner {
    transform: rotateY(180deg);
}

.modal-flip-front,
.modal-flip-back {
    position: relative;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-flip-back {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotateY(180deg);
}

#modalFlipToggleBtn:hover {
    background: rgba(0, 123, 255, 1) !important;
    transform: translateX(-50%) scale(1.05);
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* Tablet */
@media (max-width: 768px) {
    .main-content {
        padding: 5px 0;
        min-height: 85vh;
    }
    
    .nav-buttons-container {
        padding: 8px 0;
        gap: 15px;
    }
    
    .card-row {
        flex: 1;
        min-height: 40vh;
        padding: 0.5rem 1rem;
        gap: 15px;
    }
    
    .card-item {
        width: 35vh;
        min-width: 250px;
    }
    
    .modal-card-row {
        min-height: 300px !important;
    }
    
    .modal-card-item {
        width: 20vh;
        min-width: 150px;
    }
    
    .nav-button {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .nav-counter {
        padding: 6px 10px;
        font-size: 14px;
        min-width: 60px;
    }
    
    .modal-nav-button {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .modal-nav-counter {
        padding: 4px 8px;
        font-size: 12px;
        min-width: 50px;
    }
    
    .modal-nav-buttons-container {
        padding: 8px 0;
        gap: 10px;
    }
    
    .floating-see-more {
        bottom: 15px;
        right: 15px;
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .conversation-prompt-btn,
    .flip-back-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
    
    .expand-icon,
    .expand-back-button {
        width: 35px;
        height: 35px;
    }
    
    .audio-player-container {
        padding: 20px;
        min-width: 250px;
    }
    
    .audio-label {
        font-size: 1rem;
        padding: 8px 12px;
    }
    
    .individual-audio-container {
        padding: 30px;
        min-width: 300px;
    }
    
    .individual-audio-label {
        font-size: 1.2rem;
        padding: 12px 16px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .main-content {
        padding: 2px 0;
    }
    
    .nav-buttons-container {
        padding: 5px 0;
        gap: 10px;
    }
    
    .card-row {
        min-height: 35vh;
        padding: 0.25rem 0.5rem;
        gap: 10px;
    }
    
    .card-item {
        width: 30vh;
        min-width: 220px;
    }
    
    .nav-button {
        width: 35px;
        height: 35px;
        font-size: 12px;
    }
    
    .nav-counter {
        padding: 4px 8px;
        font-size: 12px;
        min-width: 50px;
    }
    
    .modal-card-row {
        min-height: 250px !important;
        padding: 15px 20px 50px 20px !important;
    }
    
    .modal-card-item {
        width: 18vh;
        min-width: 130px;
    }
    
    .conversation-prompt-btn,
    .flip-back-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .expand-icon,
    .expand-back-button {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .audio-player-container {
        padding: 15px;
        min-width: 200px;
        gap: 15px;
    }
    
    .audio-label {
        font-size: 0.9rem;
        padding: 6px 10px;
    }
    
    .audio-player {
        height: 44px;
    }
    
    .individual-audio-container {
        padding: 20px;
        min-width: 250px;
        gap: 20px;
    }
    
    .individual-audio-label {
        font-size: 1.1rem;
        padding: 10px 15px;
    }
    
    .individual-audio-player {
        height: 50px;
    }
}