/* Reset a základní styly */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f6f8;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background-color: #3498db;
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header h1 {
    margin-bottom: 15px;
}

nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-btn {
    background: none;
    border: none;
    color: white;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
    transition: background-color 0.2s;
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.nav-btn.active {
    background-color: rgba(255, 255, 255, 0.3);
    font-weight: bold;
}

main {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    min-height: 500px;
}

footer {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    color: #666;
    font-size: 14px;
}

/* Sekce */
.hidden-section {
    display: none;
}

.active-section {
    display: block;
}

/* Balíčky kartiček */
.decks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.deck-card {
    background-color: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 1px solid #e0e0e0;
}

.deck-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.deck-card h3 {
    color: #2980b9;
    margin-bottom: 10px;
}

.deck-card .deck-stats {
    color: #666;
    font-size: 14px;
}

/* Flashcard */
.flashcard-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 30px 0;
    min-height: 400px;
}

.flashcard {
    width: 100%;
    max-width: 600px;
    min-height: 350px;
    perspective: 1000px;
    position: relative;
    cursor: pointer; /* Přidáno: změna kurzoru na pointer, aby bylo jasné, že lze kliknout */
}

.card-side {
    position: relative;
    width: 100%;
    min-height: 350px;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 20px;
    overflow-y: auto;
    transition: all 0.3s ease;
    cursor: pointer; /* Přidáno: změna kurzoru na pointer, aby bylo jasné, že lze kliknout */
}

/* Přidání stylu pro štítek zdroje */
.source-label {
    display: inline-block;
    background-color: #3498db;
    color: white;
    padding: 2px 6px;
    font-size: 12px;
    border-radius: 3px;
    margin-top: 5px;
}

/* Zvýraznění a úprava stylů pro lepší čitelnost */
.card-front, .card-back {
    font-size: 20px;
    line-height: 1.6;
    padding: 30px;
}

.card-front {
    background-color: #ecf0f1;
    color: #2c3e50;
    font-weight: bold;
}

.card-back {
    background-color: #d6eaf8;
    color: #34495e;
}

.card-front {
    background-color: #ecf0f1;
    z-index: 1;
}

.card-back {
    background-color: #d6eaf8;
}

.hidden {
    display: none !important;
}

/* Přidání náznaku kliknutelnosti */
.card-front:hover, .card-back:hover {
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.3); /* Přidáno: zvýraznění stínu při najetí myší */
    transform: translateY(-2px); /* Přidáno: mírné nadzvednutí kartičky při najetí myší */
}

/* Přidání nápovědy k otáčení kartiček */
.flashcard::after {
    content: "Klikněte pro otočení";
    position: absolute;
    bottom: 5px;
    right: 5px;
    font-size: 12px;
    color: #95a5a6;
    opacity: 0.7;
    pointer-events: none; /* aby nápověda nebránila kliknutí na kartu */
}

/* Kontrolní tlačítka */
.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

.control-btn, .rating-btn, .primary-btn, .secondary-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s;
}

.control-btn:hover, .primary-btn:hover {
    background-color: #2980b9;
}

.secondary-btn {
    background-color: #95a5a6;
    margin: 5px;
}

.secondary-btn:hover {
    background-color: #7f8c8d;
}

.study-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.rating-btns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.rating-btn {
    font-size: 14px;
    padding: 8px 15px;
}

.rating-btn[data-rating="1"] {
    background-color: #e74c3c;
}

.rating-btn[data-rating="3"] {
    background-color: #f39c12;
}

.rating-btn[data-rating="4"] {
    background-color: #2ecc71;
}

.rating-btn[data-rating="5"] {
    background-color: #27ae60;
}

/* Upload formulář */
.upload-form {
    max-width: 500px;
    margin: 0 auto;
}

.file-upload {
    margin: 20px 0;
    text-align: center;
}

.file-upload label {
    display: block;
    background-color: #3498db;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 10px;
    transition: background-color 0.2s;
}

.file-upload label:hover {
    background-color: #2980b9;
}

.file-upload input {
    display: none;
}

#selected-file {
    color: #666;
    font-size: 14px;
}

#upload-progress {
    text-align: center;
    margin: 20px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-left-color: #3498db;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Zprávy */
.message {
    text-align: center;
    padding: 20px;
    color: #666;
}

.success-message {
    color: #27ae60;
}

.error-message {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
}

/* Styly pro zprávy s varováním */
.warning-message {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
}

.actions-container {
    margin-top: 15px;
    text-align: center;
}

/* Progress bar */
.deck-info {
    text-align: center;
    margin-bottom: 20px;
}

.progress-container {
    width: 100%;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin: 10px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #3498db;
    width: 0%;
    transition: width 0.3s ease;
}

#progress-text {
    color: #666;
    font-size: 14px;
}

/* Přepínač (toggle switch) pro nastavení */
.settings-container {
    margin: 10px auto;
    text-align: center;
}

.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 5px 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: #ccc;
    border-radius: 34px;
    transition: .4s;
    margin-right: 10px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: .4s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #3498db;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 14px;
    color: #666;
}

/* Styly pro obrázky v kartičkách */
.card-side img {
    max-width: 100%;
    max-height: 350px;
    margin: 10px auto;
    display: block;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    object-fit: contain;
}

/* Zvětšit výšku kartiček s obrázky */
.flashcard.has-image .card-side {
    min-height: 450px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 15px;
}

/* Indikátor načítání obrázku */
.image-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: #3498db;
    animation: spin 1s linear infinite;
    margin: 10px auto;
}

/* Styly pro načítání textových kartiček */
.text-deck-options {
    margin: 20px 0;
    text-align: center;
}

.hint-text {
    color: #666;
    font-size: 14px;
    margin-top: 8px;
}

.loading-indicator {
    text-align: center;
    margin: 20px 0;
}

.loading-indicator p {
    color: #666;
    margin-top: 10px;
}

/* Výraznější indikátor načítání */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    text-align: center;
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    border: 1px solid #e9ecef;
}

.loading-indicator .spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-left-color: #3498db;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

.loading-indicator p {
    color: #666;
    margin-top: 15px;
    font-size: 16px;
}

/* Toast zprávy */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    z-index: 1000;
    max-width: 300px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    transform: translateX(110%);
    transition: transform 0.3s ease;
}

.toast.show-toast {
    transform: translateX(0);
}

.info-toast {
    background-color: #3498db;
}

.success-toast {
    background-color: #2ecc71;
}

.warning-toast {
    background-color: #f39c12;
}

.error-toast {
    background-color: #e74c3c;
}

/* Vercel specifické styly */
.vercel-notice {
    text-align: center;
    padding: 8px;
    margin: 10px 0;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    color: #666;
}

/* Vylepšení pro error zprávu */
.error-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    text-align: center;
}

/* Diagnostické zprávy */
.status-info {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(52, 152, 219, 0.9);
    color: white;
    padding: 15px;
    border-radius: 5px;
    font-size: 14px;
    max-width: 300px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 1;
    transition: opacity 1s ease;
}

.status-info p {
    margin: 5px 0;
}

.status-info.fade-out {
    opacity: 0;
}

/* Nouzové tlačítko pro reset karty */
#emergency-reset-button {
    background-color: #e74c3c;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Pomocné třídy pro debugování */
.debug-overlay {
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 12px;
    z-index: 9999;
    max-width: 300px;
    max-height: 200px;
    overflow: auto;
}

/* Skrytí nechtěných prvků pomocí CSS */
.unwanted-text,
*:contains('Studovat Resetovat Smazat') {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    pointer-events: none !important;
}

/* Speciální úprava pro obrazovou galerii */
.abstract-art-gallery .card-front {
    background-color: #f8f8f8;
    display: flex;
    justify-content: center;
    align-items: center;
}

.abstract-art-gallery .card-back {
    font-size: 18px;
    line-height: 1.6;
    padding: 20px;
    color: #333;
    background-color: #f0f9ff;
}
