/* Globálne nastavenia */
body {
    background: #1a1a1a;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    color: #fff;
}

main {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 15px;
    gap: 15px;
}

/* Karta a Nová karta */
.karta, .nova_karta {
    width: 100%;
    max-width: 340px;
    height: 180px;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
    box-shadow: 0 8px 15px rgba(0,0,0,0.3);
    border: none;
    color: #1a1a1a;
}

.preview-karta {
    height: 120px !important;
    max-width: 250px !important;
    border-radius: 12px;
}

@media (hover: hover) {
    .karta:hover:not(.preview-karta) { 
        transform: translateY(-5px); 
        box-shadow: 0 12px 20px rgba(0,0,0,0.4);
    }
}

.karta h2 { 
    margin: 5px 0 2px 0; 
    font-size: 1.5rem; 
    font-weight: 800;
}

.karta-desc {
    margin: 0 0 8px 0 !important;
    font-size: 0.85rem;
    opacity: 0.7;
    font-weight: 500 !important;
    font-family: inherit !important;
}

.karta-number { 
    margin: 0; 
    opacity: 0.9; 
    font-family: 'Courier New', Courier, monospace; 
    letter-spacing: 1.5px;
    font-weight: bold;
    max-width: 90%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.karta img {
    max-height: 45px;
    max-width: 70%;
    margin-bottom: 5px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.nova_karta {
    background: #2a2a2a;
    color: #EF6534;
    border: 3px dashed #EF6534;
    box-shadow: none;
}

.nova_karta h2 { font-size: 3rem; margin: 0; }

/* Nastavenia tlačidiel */
.edit-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.5);
    backdrop-filter: blur(5px);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modály */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex; justify-content: center; align-items: center;
    z-index: 100;
    padding: 15px;
    box-sizing: border-box;
}

.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 25px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    color: #333;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 { margin-top: 0; }

input {
    width: 100%;
    padding: 14px;
    margin: 8px 0;
    border: 2px solid #eee;
    border-radius: 12px;
    box-sizing: border-box;
    font-size: 16px;
}

input:focus {
    border-color: #EF6534;
    outline: none;
}

.input-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 5px 0;
    font-weight: bold;
}

.modal-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.btn-save { grid-column: span 2; background: #28a745; color: white; padding: 15px; }
.btn-delete { background: #dc3545; color: white; }
.btn-cancel { background: #6c757d; color: white; }

button {
    padding: 12px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
}

/* Template List Item */
#templateList {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 5px;
}

.template-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.template-item:last-child {
    border-bottom: none;
}

/* Detail karty a kódy */
#codeContainer {
    background: white;
    padding: 15px;
    border-radius: 15px;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 150px;
    overflow-x: auto;
    max-width: 100%;
}

#barcode { width: 100% !important; height: 80px !important; min-width: 100%; }
#qrcode { max-width: 100%; height: auto !important; }

@media (max-width: 350px) {
    .karta, .nova_karta { height: 150px; }
}