/* ui-core.css - FINAL v1.4 (Toast Alignment Fix) */
/* OBSAHUJE: Tlačítka, Inputy, Základní karty, Modály (Base), Toasty, Spinner */

/* --- 1. SYSTÉM TLAČÍTEK (Atomické prvky) --- */
.btn {
    font-size: 1em;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    line-height: 1.2;
    width: 100%;
    min-height: 50px;
    box-sizing: border-box;
    transition: var(--transition);
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.btn:active:not(:disabled) {
    transform: translateY(0px) scale(0.98);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    filter: grayscale(0.5);
}

.btn svg,
.btn svg.feather {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
    flex-shrink: 0;
}

/* Varianty tlačítek */
.btn--primary {
    background-color: var(--c-primary);
    color: #000000;
    border-color: var(--c-primary);
    font-weight: 800;
}

.btn--primary:hover:not(:disabled) {
    background-color: var(--c-primary-hover);
    border-color: var(--c-primary-hover);
}

.btn--secondary {
    background-color: var(--c-surface);
    color: var(--c-secondary);
    border: 1px solid var(--c-border);
}

.btn--secondary:hover:not(:disabled) {
    background-color: #f8f9fa;
    color: var(--c-text);
    border-color: var(--c-secondary);
}

.night-mode .btn--secondary {
    background-color: transparent;
    color: var(--c-text);
    border-color: var(--c-border);
}

.night-mode .btn--secondary:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.05);
}

.btn--tertiary {
    background-color: transparent;
    border: none;
    color: var(--c-text-muted);
    font-weight: 500;
    box-shadow: none;
}

.btn--tertiary:hover:not(:disabled) {
    color: var(--c-text);
    background-color: var(--c-border);
    box-shadow: none;
    transform: none;
}

.btn--danger {
    background-color: #343a40;
    color: white;
    border-color: #343a40;
}

.btn--danger:hover:not(:disabled) {
    background-color: #23272b;
    border-color: #1d2124;
}

.btn--danger-red {
    background-color: var(--c-danger);
    color: white;
    border: none;
}

.btn--danger-red:hover:not(:disabled) {
    background-color: var(--c-danger-hover);
}

.btn--warning {
    background-color: var(--c-warning);
    color: #333;
    border-color: var(--c-warning);
}

.btn--warning:hover:not(:disabled) {
    background-color: var(--c-warning-hover);
    border-color: var(--c-warning-hover);
}

.btn--info {
    background-color: var(--c-info);
    color: white;
    border-color: var(--c-info);
}

.btn--info:hover:not(:disabled) {
    background-color: var(--c-info-hover);
    border-color: var(--c-info-hover);
}

/* --- 2. FORMULÁŘE A VSTUPY --- */
input[type=text],
input[type=number],
input[type=password],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--c-border);
    border-radius: 6px;
    font-size: 1em;
    box-sizing: border-box;
    background-color: var(--c-bg);
    color: var(--c-text);
    transition: var(--transition);
    font-family: var(--font-main);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.25);
    outline: none;
    background-color: var(--c-surface);
}

/* Odstranění spinnerů u čísel */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

.form-field {
    margin-bottom: 15px;
}

.form-field:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 5px;
    font-size: .9em;
    color: var(--c-text-muted);
    font-weight: 500;
    transition: color 0.3s;
}

/* --- 3. MODÁLNÍ OKNA (Base Layout) --- */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.dialog-box {
    background-color: var(--c-surface);
    padding: 24px;
    border: 1px solid var(--c-border);
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 320px;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    transition: background-color 0.3s, border-color 0.3s;
}

.dialog-box h3 {
    margin: 0 0 10px 0;
    font-size: 1.3em;
    font-weight: 700;
    color: var(--c-text);
    text-align: center;
    transition: color 0.3s;
}

.dialog-box p {
    color: var(--c-text);
    transition: color 0.3s;
    line-height: 1.4;
    font-size: 1em;
    margin: 0 0 10px 0;
}

.dialog-box p strong {
    color: var(--c-text);
    font-weight: 700;
}

.dialog-buttons {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    justify-content: center;
    width: 100%;
}

.dialog-buttons button.btn {
    flex-grow: 1;
    min-width: 100px;
}

/* --- 4. TOAST NOTIFIKACE --- */
#toast-container {
    position: fixed;
    /* FIX: Zarovnání na úroveň hlavičky */
    top: 10px; 
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
}

.toast {
    background-color: var(--c-surface);
    color: var(--c-text);
    padding: 15px 20px;
    padding-right: 45px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    transform: translateX(100%);
    position: relative;
    border-left: 5px solid transparent;
}

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

.toast.toast-success {
    border-left-color: var(--c-primary);
}

.toast.toast-success .toast-icon {
    color: var(--c-primary);
    font-weight: bold;
}

.toast.toast-info {
    border-left-color: var(--c-warning);
}

.toast.toast-info .toast-icon {
    color: var(--c-warning);
    font-weight: bold;
}

.toast.toast-error {
    border-left-color: var(--c-danger);
}

.toast.toast-error .toast-icon {
    color: var(--c-danger);
    font-weight: bold;
}

.toast-close-btn {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    font-size: 1.5em;
    color: var(--c-text-muted);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    border-radius: 50%;
}

.toast-close-btn:hover {
    color: var(--c-text);
    background-color: rgba(0, 0, 0, 0.05);
}

.night-mode .toast {
    background-color: #1C1C1E;
    border: 1px solid var(--c-border);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

/* --- 5. LOADING SPINNER (Global) --- */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--c-border);
    border-top: 4px solid var(--c-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

#loader-overlay {
    position: fixed;
    inset: 0;
    background: var(--c-surface);
    opacity: 0.98;
    z-index: 9000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--c-text);
    font-weight: 700;
}