* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 10px;
    padding-bottom: 20px;
    overflow-x: hidden;
}

.container {
    /* max-width: 1200px; */
    margin: 0 auto;
    min-height: calc(100vh - 40px); /* Osiguraj da container ima dovoljno visine */
    position: relative;
}

.header {
    display: block;
    position: relative;

    /* background: rgba(255, 255, 255, 0.1); */
    /* -webkit-backdrop-filter: blur(10px); */
    /* backdrop-filter: blur(10px); */
    /* padding: 20px; */
    /* border-radius: 15px; */
    /* border: 1px solid rgba(255, 255, 255, 0.2); */
}

.header.hidden {
    display: none;
}

h1 {
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.dropdown {
    position: absolute;
    right: 0;
}

select {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

select:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.cards-grid {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.card {
    perspective: 1000px;
    height: calc(100vh - 200px); /* Zauzima skoro cijeli ekran, ostavlja 200px za header i kontrole */
    width: 90vw;
    max-width: 800px;
    min-height: 400px; /* Minimalna visina */
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card.show-both .card-inner {
    transform: none !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card.show-both .card-front,
.card.show-both .card-back {
    display: none;
}

.card.show-both .card-content {
    width: 100%;
    color: #333;
}

.card.show-both .question-section,
.card.show-both .answer-section {
    margin-bottom: 25px;
    padding: 15px;
    border-radius: 10px;
}

.card.show-both .question-section {
    background: rgba(33, 150, 243, 0.1);
    border-left: 4px solid #2196F3;
}

.card.show-both .answer-section {
    background: rgba(76, 175, 80, 0.1);
    border-left: 4px solid #4CAF50;
    margin-bottom: 0;
}

.card.show-both h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card.show-both .question-section h4 {
    color: #2196F3;
}

.card.show-both .answer-section h4 {
    color: #4CAF50;
}

.card.show-both .full-answer-section {
    background: rgba(156, 39, 176, 0.1);
    border-left: 4px solid #9C27B0;
    margin-bottom: 0;
    margin-top: 25px;
}

.card.show-both .full-answer-section h4 {
    color: #9C27B0;
    font-size: 0.9rem;
}

.card.show-both .full-answer-section p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #555;
}

.card.show-both p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 0;
}

.card.show-both {
    height: auto;
    min-height: calc(100vh - 200px); /* Koristi istu logiku kao glavna kartica */
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-front {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #333;
}

.card-back {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.9) 0%, rgba(139, 195, 74, 0.9) 100%);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transform: rotateY(180deg);
    color: white;
}

.card-back .full-answer-section {
    background: rgba(156, 39, 176, 0.1);
    border-left: 4px solid #9C27B0;
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
}

.card-back .full-answer-section h4 {
    color: #9C27B0;
    font-size: 0.9rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.card-back .full-answer-section p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #333;
    margin: 0;
}

.card-content {
    font-size: 1.1rem;
    line-height: 1.6;
    font-weight: 500;
}

.card-front .card-content {
    font-weight: 600;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.controls-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4CAF50;
}

.checkbox-container:hover {
    opacity: 0.8;
}

.btn {
    background: rgba(255, 255, 255, 0.2);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 12px 25px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn:disabled:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: none;
    box-shadow: none;
}

.heat-map {
    background: rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 30px;
}

.heat-map h3 {
    color: white;
    margin-bottom: 15px;
    font-size: 1.2rem;
    text-align: center;
}

.heat-map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    gap: 4px;
    /* max-width: 600px; */
    margin: 0 auto;
}

.heat-map-item {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.heat-map-item:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.heat-map-item.opened {
    background: rgba(76, 175, 80, 0.8);
    color: white;
}

.heat-map-item.current {
    border: 2px solid #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.heat-map-item.opened:hover {
    background: rgba(76, 175, 80, 0.9);
}

.heat-map-item.known {
    background: rgba(46, 125, 50, 0.9);
    border: 2px solid #2E7D32;
    color: white;
    box-shadow: 0 0 8px rgba(46, 125, 50, 0.5);
}

.heat-map-item.known:hover {
    background: rgba(46, 125, 50, 1);
    border: 2px solid #1B5E20;
    transform: scale(1.1);
}

.heat-map-item.unknown {
    background: rgba(211, 47, 47, 0.9);
    border: 2px solid #D32F2F;
    color: white;
    box-shadow: 0 0 8px rgba(211, 47, 47, 0.5);
}

.heat-map-item.unknown:hover {
    background: rgba(211, 47, 47, 1);
    border: 2px solid #B71C1C;
    transform: scale(1.1);
}

.heat-map.hidden {
    display: none;
}

.heat-map-reset {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.btn.reset-btn {
    background: rgba(220, 53, 69, 0.3);
    border: 1px solid rgba(220, 53, 69, 0.5);
    color: white;
    font-size: 14px;
    padding: 8px 16px;
}

.btn.reset-btn:hover:not(:disabled) {
    background: rgba(220, 53, 69, 0.5);
    border: 1px solid rgba(220, 53, 69, 0.7);
}

.btn.back-btn {
    display: none;
}

.btn.back-btn.visible {
    display: inline-block;
}

.no-cards {
    text-align: center;
    color: white;
    font-size: 1.2rem;
    margin-top: 50px;
    opacity: 0.8;
}

/* Test Mode Styles */
.test-mode {
    display: block;
}

.test-mode.hidden {
    display: none;
}

.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 30px;
}

.test-header h2 {
    color: white;
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
}

.test-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 0 10px;
    margin-bottom: 30px;
}

.test-card-item {
    background: rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.test-card-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.test-card-small {
    perspective: 1000px;
    height: 250px;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.test-card-small-inner {
    position: relative;
    width: 100%;
    height: calc(100% - 60px); /* Ostavlja 60px za dugmove */
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.test-card-small.flipped .test-card-small-inner {
    transform: rotateY(180deg);
}

.test-card-small-front,
.test-card-small-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.test-card-small-front {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
    color: #333;
}

.test-card-small-back {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.9) 0%, rgba(139, 195, 74, 0.9) 100%);
    transform: rotateY(180deg);
    color: white;
}

.test-card-small-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 15px 10px 10px 10px;
    overflow-y: auto;
}

/* Custom scrollbar styles for test cards */
.test-card-small-content::-webkit-scrollbar,
.answer-text::-webkit-scrollbar,
.question-text::-webkit-scrollbar {
    width: 4px;
}

.test-card-small-content::-webkit-scrollbar-track,
.answer-text::-webkit-scrollbar-track,
.question-text::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.test-card-small-content::-webkit-scrollbar-thumb,
.answer-text::-webkit-scrollbar-thumb,
.question-text::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.test-card-small-content::-webkit-scrollbar-thumb:hover,
.answer-text::-webkit-scrollbar-thumb:hover,
.question-text::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.card-number {
    position: absolute;
    top: 10px;
    right: 15px;
    background: rgba(0, 0, 0, 0.2);
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.question-text {
    font-size: 0.95rem;
    line-height: 1.4;
    font-weight: 600;
    text-align: center;
    word-wrap: break-word;
    max-height: calc(100% - 40px);
    overflow-y: auto;
    width: 100%;
}

.answer-text {
    width: 100%;
    text-align: left;
    max-height: calc(100% - 10px); /* Ostavi prostora za dugmove */
    overflow-y: auto;
    padding-right: 5px;
}

.answer-text h4 {
    color: #0f6212;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.answer-text p {
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
    word-wrap: break-word;
}

.answer-text .full-answer-section {
    background: rgba(156, 39, 176, 0.2);
    border-left: 3px solid #9C27B0;
    padding: 8px;
    border-radius: 5px;
    margin-top: 10px;
}

.answer-text .full-answer-section h4 {
    color: #9C27B0;
    font-size: 0.8rem;
    margin-bottom: 5px;
}

.answer-text .full-answer-section p {
    font-size: 0.8rem;
    line-height: 1.3;
    word-wrap: break-word;
}

.test-card-controls {
    display: flex;
    gap: 10px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.1);
    justify-content: center;
    height: 60px;
    align-items: center;
    margin-top: auto;
}

.btn-small {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.btn-small.known-btn {
    background: rgba(76, 175, 80, 0.8);
}

.btn-small.known-btn:hover {
    background: rgba(76, 175, 80, 1);
    transform: translateY(-1px);
}

.btn-small.unknown-btn {
    background: rgba(244, 67, 54, 0.8);
}

.btn-small.unknown-btn:hover {
    background: rgba(244, 67, 54, 1);
    transform: translateY(-1px);
}

.test-card-item.completed {
    opacity: 0.7;
    transform: scale(0.95);
}

.test-card-item.completed.known {
    border: 3px solid #2E7D32;
    box-shadow: 0 0 15px rgba(46, 125, 50, 0.4);
}

.test-card-item.completed.unknown {
    border: 2px solid #f44336;
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.3);
}

.test-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.test-control-btn {
    min-width: 120px;
    padding: 15px 25px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.finish-btn {
    background: rgba(156, 39, 176, 0.3);
    border: 1px solid rgba(156, 39, 176, 0.5);
    color: white;
}

.finish-btn:hover:not(:disabled) {
    background: rgba(156, 39, 176, 0.5);
    border: 1px solid rgba(156, 39, 176, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.3);
}

.test-btn {
    background: rgba(33, 150, 243, 0.3);
    border: 1px solid rgba(33, 150, 243, 0.5);
    color: white;
}

.test-btn:hover:not(:disabled) {
    background: rgba(33, 150, 243, 0.5);
    border: 1px solid rgba(33, 150, 243, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.3);
}

.hidden {
    display: none !important;
}

/* Card Knowledge Controls */
.card-knowledge-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px;
    padding: 0 20px;
}

.card-knowledge-controls.hidden {
    display: none;
}

.knowledge-btn {
    min-width: 120px;
    padding: 12px 25px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.knowledge-btn.known-btn {
    background: rgba(76, 175, 80, 0.3);
    border: 1px solid rgba(76, 175, 80, 0.5);
    color: white;
}

.knowledge-btn.known-btn:hover:not(:disabled) {
    background: rgba(76, 175, 80, 0.5);
    border: 1px solid rgba(76, 175, 80, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}

.knowledge-btn.unknown-btn {
    background: rgba(244, 67, 54, 0.3);
    border: 1px solid rgba(244, 67, 54, 0.5);
    color: white;
}

.knowledge-btn.unknown-btn:hover:not(:disabled) {
    background: rgba(244, 67, 54, 0.5);
    border: 1px solid rgba(244, 67, 54, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.3);
}

/* Mobile responsiveness for knowledge controls */
@media (max-width: 768px) {
    .card-knowledge-controls {
        gap: 15px;
        margin: 15px;
        padding: 0 10px;
    }
    
    .knowledge-btn {
        min-width: 100px;
        padding: 10px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .card-knowledge-controls {
        gap: 10px;
        margin: 10px;
        padding: 0 5px;
    }
    
    .knowledge-btn {
        min-width: 80px;
        padding: 8px 15px;
        font-size: 13px;
    }
}

/* Mobile responsiveness for test mode */
@media (max-width: 768px) {
    .test-header {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .test-header h2 {
        font-size: 1.4rem;
    }
    
    .test-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 15px;
        padding: 0 5px;
    }
    
    .test-card-small {
        height: 220px;
    }
    
    .test-card-small-inner {
        height: calc(100% - 55px);
    }
    
    .question-text {
        font-size: 0.9rem;
        -webkit-line-clamp: 5;
    }
    
    .answer-text p {
        font-size: 0.85rem;
        -webkit-line-clamp: 3;
    }
    
    .test-card-controls {
        padding: 8px 12px;
        gap: 8px;
        height: 55px;
    }
    
    .btn-small {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .test-cards-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 0;
    }
    
    .test-card-small {
        height: 200px;
    }
    
    .test-card-small-inner {
        height: calc(100% - 50px);
    }
    
    .question-text {
        font-size: 0.85rem;
        -webkit-line-clamp: 4;
    }
    
    .answer-text p {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
    }
    
    .card-number {
        width: 25px;
        height: 25px;
        font-size: 12px;
        top: 8px;
        right: 10px;
    }
    
    .test-header h2 {
        font-size: 1.2rem;
    }
    
    .test-card-controls {
        padding: 8px 10px;
        gap: 6px;
        height: 50px;
    }
    
    .btn-small {
        padding: 5px 8px;
        font-size: 11px;
    }
}