/* CARDMODAL - Primary card modal behavior and positioning */
.card-modal {
   /*NEW*/
   background: var(--background-color);
   border-radius: var(--border-radius);
   width: 100%; /* Updated from 95% to 100% for better width utilization */
   max-width: min(100vw, 100%); /* Updated to use full viewport width */
   height: 70vh;
   max-height: 70vh;
   display: flex;
   flex-direction: column;
   position: fixed;
   top: var(--header-height, 56px); /* fallback to 56px if not set */
   left: 50%;
   transform: translateX(-50%);
   box-shadow: var(--shadow-lg);
   margin: 0 auto;
   box-sizing: border-box;
   overflow: hidden; /* Changed from overflow-y: auto to prevent double scrollbars */
   word-wrap: break-word;
   overflow-wrap: break-word;
   z-index: 2000;
   /*END OF NEW*/
   /*OLD
    position: fixed;
    top: 0;
    left:0;
    width: 100%;
    height: 100%;
    /*background-color: rgba(0, 0, 0, 0.7);*/
   /* display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    overflow-y: auto;
    padding: 1px 5px;
    padding-top: var(--header-height);
    box-sizing: border-box;
    backdrop-filter: blur(5px);
 END OF OLD */
}

.card-content {
    background: var(--background-color);
    padding: 0px 10px 2px 10px; /* Reduced padding for more width */
    border-radius: 12px;
    width: 98%; /* Increased to almost full width */
    max-width: min(98vw, 98%); /* Increased to use 98% of viewport width */
    height: 90%;
    max-height: 90vh;
    
    /* Maintain aspect ratio while allowing content to scroll */
    aspect-ratio: 1 / 1.3;
    
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2001;
    overflow-y: auto;
    margin: 10px auto 0;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    
    /* Center content vertically */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* Improve spacing in the rectangular format */
.card-content > * {
    margin-bottom: 12px;
}

/* Ensure card name has proper spacing */
.card-name {
    margin-top: 20px; /* Add some space at the top */
}

/* Make answers section take available space */
.card-answers {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center answers vertically */
    gap: 10px; /* Slightly increased gap */
    margin: 15px 0; /* Increased margin */
    padding-bottom: 15px; /* Add padding at bottom */
}

/* Make timer container align with card shape */
.timer-container {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

/* CARDMODAL - Media queries for different screen sizes */
@media (max-width: 768px) {
    .card-content {
        width: 98%; /* Updated to match new 98% field width */
        max-width: 98vw; /* Updated to use 98% of viewport width */
        height: 95%;
        max-height: 95vh;
    }
}

@media (max-height: 600px) {
    .card-content {
        height: 95%;
        max-height: 95vh;
    }
}

/* CARDMODAL - PC view adjustments */
/*@media (min-width: 1200px) {
    .card-modal {
        position: absolute;
        top: var(--header-height);
        left: auto;
        right: 0;
        bottom: 0;
        width: 300px;
        height: 60%;
    }
    
    .card-content {
        max-width: min(600px, 70vh); /* Reduced from 800px to 600px*/
      /*  max-height: calc(100vh - var(--header-height) - 40px); /* Added more padding */
       /* width: 70%; /* Reduced from 90% */
       /* height: 85%; /* Reduced from 90% */
   /* }
}*/

/* CARDMODAL - Question card specific adjustments */
.card-content.with-question {
    width: 98%; /* Increased to almost full width */
    max-width: min(98vw, 98%); /* Increased to use 98% of viewport width */
}

/* Card content sections */
.card-name,
.card-description,
.card-question {
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
    margin-bottom: var(--spacing);
    position: relative;
    z-index: 2002;
}

.card-name {
    font-size: 1.4rem; /* Increased from 1.2rem for better readability */
    font-weight: bold;
    margin-bottom: 12px;
    color: var(--primary-color);
    text-align: center;
}

.card-description {
    font-size: 15px; /* Increased from 14px for better readability */
    color: var(--text-color);
    font-weight: bold;
    margin-bottom: 6px;
    padding: 8px; /* Increased padding */
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.card-question {
    font-size: 16px; /* Increased from 14px for better readability */
    margin-bottom: 6px;
    padding: 8px; /* Increased padding */
    background: var(--background-color);
    border-radius: 8px;
    border: 0px solid #757070;
    text-align: center;
    font-weight: 400;
    color: var(--text-color);
}

/* Answer buttons */
.answer-button {
    width: 100%;
    min-height: 44px;
    padding: 14px;
    margin: 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    color: var(--text-color);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    font-size: 14px; /* Increased from 12px for better readability */
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    pointer-events: auto; /* Ensure button itself receives clicks */
}

/* Ensure nested elements don't block clicks on answer buttons */
.answer-button * {
    pointer-events: none;
    user-select: none;
}

.answer-button:hover {
    background: var(--background-color);
    border-color: var(--primary-color);
}

.answer-button:active {
    transform: scale(0.98);
}

.answer-button.answered-correct {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.answer-button.answered-incorrect {
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid #f44336;
    color: #c62828;
}

.answer-button.selected {
    background: var(--primary-color);
    color: white;
    font-weight: bold;
}

.answer-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* CARDMODAL - Answer button adjustments for PC */
@media (min-width: 1200px) {
    .card-content.with-question .answer-button {
        width: 95%; /* Updated from 70% to 95% for better field utilization */
        margin: 0 auto;
        font-size: 13px;
        padding: 10px;
    }
}

/* Timer styles */
.timer-container {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background-color: var(--background-color);
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    z-index: 2003;
    margin: -15px -15px 15px -15px;
}

.timer-bar {
    width: 90%;
    height: 100%;
    background-color: var(--primary-color);
    transition: width linear 1s, background-color 0.3s;
}

.timer-bar.warning {
    background-color: var(--warning-color);
}

.timer-bar.critical {
    background-color: var(--error-color);
    animation: flashBackground 1s infinite;
}

.timer-text {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.9rem;
    color: var(--text-color);
    z-index: 2003;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.timer-text.warning {
    color: var(--warning-color);
    font-weight: bold;
}

.timer-text.critical {
    color: var(--error-color);
    font-weight: bold;
    animation: flashText 1s infinite;
}

/* Animations */
@keyframes flashBackground {
    0% { background-color: var(--error-color); }
    50% { background-color: var(--primary-color); }
    100% { background-color: var(--error-color); }
}

@keyframes flashText {
    0% { color: var(--error-color); }
    50% { color: var(--text-color); }
    100% { color: var(--error-color); }
}

/* Media queries for smaller screens */
@media (max-width: 480px) {
    .card-content {
        width: 98%; /* Updated to match new 98% field width */
        padding: 12px; /* Slightly reduced for more width */
    }
    
    .card-name {
        font-size: 1.3rem; /* Increased from 1.1rem */
    }
    
    .card-question {
        font-size: 15px; /* Increased from 13px */
        padding: 10px;
    }
    
    .answer-button {
        font-size: 14px; /* Increased from 13px */
        padding: 12px; /* Slightly increased */
    }
}

/* Add extra spacing for better readability */
.card-content.with-question .card-question {
    margin: 8px 0;
    padding: 10px;
    font-size: 16px; /* Increased from 10px for better readability */
    line-height: 1.5;
}

/* Adjust timer to match the narrower card */
.card-content.with-question .timer-container {
    border-radius: 10px 10px 0 0;
}

.card-answer-option {
    font-size: 12px; /* Increased from 10px for better readability */
    padding: 8px 12px; /* Added padding for better spacing */
    margin: 4px auto; /* Center the answer options */
    border-radius: 6px; /* Added border radius for consistency */
    width: 95%; /* Use 95% of the dialog content width */
    box-sizing: border-box; /* Ensure padding is included in width */
    word-wrap: break-word; /* Handle long text */
    overflow-wrap: break-word; /* Modern word wrapping */
    line-height: 1.4; /* Better line height for readability */
    display: block; /* Ensure proper block display */
}

/* Markdown image styles within card content */
.card-content img {
    max-width: 100%;
    height: auto;
    max-height: 200px; /* Maximum height for images */
    object-fit: contain;
    display: block;
    margin: 10px auto;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Specific styles for images within answer buttons */
.answer-button img {
    max-height: 80px !important; /* Smaller max height for answer images */
    margin: 5px auto !important; /* Reduced margin for answer images */
    display: inline-block !important; /* Allow images to flow with text */
    vertical-align: middle !important; /* Align with text */
    pointer-events: none !important; /* Prevent images from blocking clicks */
}

/* Responsive image adjustments */
@media (max-width: 768px) {
    .card-content img {
        max-height: 150px; /* Slightly smaller max height on mobile */
    }
    
    .answer-button img {
        max-height: 35px !important; /* Even smaller on mobile */
        pointer-events: none !important; /* Prevent images from blocking clicks */
    }
}

@media (max-height: 600px) {
    .card-content img {
        max-height: 120px; /* Even smaller max height on shorter screens */
    }
    
    .answer-button img {
        max-height: 30px !important; /* Even smaller on shorter screens */
        pointer-events: none !important; /* Prevent images from blocking clicks */
    }
} 