:root {
    --bg-dark: #0a0a0f;
    --panel-bg: rgba(22, 22, 35, 0.6);
    --primary: #9d4edd;
    --primary-glow: rgba(157, 78, 221, 0.5);
    --secondary: #3c096c;
    --accent: #ff9e00;
    --text: #e0e1dd;
    --text-muted: #8d99ae;
    --glass-border: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background: linear-gradient(135deg, var(--bg-dark), #030014);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

/* Typography a efekty */
.highlight {
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

h1,
h2,
h3 {
    font-weight: 800;
}

.glass-panel {
    background: var(--panel-bg);
    /* backdrop-filter: blur(12px); Odebráno pro drastické zvýšení výkonu na grid listu */
    /* -webkit-backdrop-filter: blur(12px); */
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ==================================
             LOGIN PAGE
   ================================== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top right, var(--secondary), var(--bg-dark) 60%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    text-align: center;
    animation: slideUp 0.8s ease-out;
}

.login-container .logo {
    margin-bottom: 30px;
}

.login-container .logo h1 {
    font-size: 3rem;
    letter-spacing: -1px;
}

.login-container .logo p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: -5px;
}

.input-group {
    text-align: left;
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    outline: none;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px var(--primary-glow);
}

.error-msg {
    color: #ef233c;
    font-size: 0.9rem;
    margin-bottom: 15px;
    display: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================================
          DASHBOARD LAYOUT
   ================================== */
.app-layout {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 260px;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
    border-radius: 0;
    /* Ponechat blur jen pro postranní panel, zde to výkon nebrzdí */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.sidebar .logo h1 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 40px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.05rem;
    border-radius: 12px;
    margin-bottom: 10px;
    transition: all 0.3s;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(157, 78, 221, 0.1);
    color: var(--primary);
}

.nav-item .icon {
    margin-right: 12px;
}

.sidebar-footer {
    margin-top: auto;
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background: rgba(239, 35, 60, 0.1);
    color: #ef233c;
    border: 1px solid rgba(239, 35, 60, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-logout:hover {
    background: #ef233c;
    color: white;
}

.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.section-header {
    margin-bottom: 30px;
}

.section-header h2 {
    font-size: 2.5rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* GRID PLUGINŮ */
.plugins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.plugin-card {
    padding: 25px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.plugin-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    border-color: var(--primary);
}

.plugin-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s;
}

.plugin-card:hover::before {
    opacity: 1;
}

.plugin-card h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: #fff;
}

.plugin-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 20px;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.actions {
    display: flex;
    gap: 10px;
}

.btn-sm {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    border: none;
    cursor: pointer;
    flex: 1;
    transition: all 0.2s;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-accent {
    background: rgba(157, 78, 221, 0.2);
    color: #e0b1ff;
    border: 1px solid var(--primary-glow);
}

.btn-accent:hover {
    background: var(--primary);
    color: #fff;
}

/* OVERLAY KÓDU */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 999;
    display: none;
    justify-content: center;
    align-items: center;
}

.overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.popup-box {
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    padding: 25px;
    display: flex;
    flex-direction: column;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.popup-header h3 {
    font-size: 1.5rem;
    color: var(--primary);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: 0.3s;
}

.btn-close:hover {
    color: #ef233c;
    transform: scale(1.1);
}

.popup-box pre {
    border-radius: 10px;
    background: #111 !important;
    padding: 15px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.popup-box pre code {
    font-family: 'JetBrains Mono', monospace;
}

/* UPLOAD FORM */
.upload-form {
    padding: 30px;
}

.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.form-group {
    margin-bottom: 20px;
}

.form-group.half {
    flex: 1;
    min-width: 250px;
}

.form-group.full {
    width: 100%;
}

.form-group label {
    display: block;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.upload-form input:not([type="file"]),
.upload-form textarea {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 1rem;
    transition: 0.3s;
}

.upload-form input:focus,
.upload-form textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 10px var(--primary-glow);
}

.file-input {
    width: 100%;
    padding: 11px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px bordered var(--glass-border);
}

.code-textarea {
    font-family: 'JetBrains Mono', monospace;
    background: #0b0b12 !important;
}

#uploadStatus {
    margin-top: 15px;
    font-weight: bold;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding: 15px;
    }

    .sidebar .logo {
        display: none;
    }

    nav {
        display: flex;
        justify-content: center;
        gap: 10px;
    }

    .nav-item {
        margin-bottom: 0;
    }

    .main-content {
        padding: 20px;
    }
}

/* ==================================
             TODO MANAGER
   ================================== */
.todo-layout {
    display: flex;
    gap: 20px;
    height: calc(100vh - 180px);
}

.todo-sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.todo-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.todo-server-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
}

.todo-server-item {
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.todo-server-item:hover, .todo-server-item.active {
    background: rgba(157, 78, 221, 0.1);
    border-color: var(--primary);
}

.todo-server-item-name {
    font-weight: 600;
    pointer-events: none;
}

.btn-delete-server {
    background: none;
    border: none;
    color: #ef233c;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-delete-server:hover {
    opacity: 1;
}

.todo-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.todo-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
}

.todo-tasks-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.todo-empty {
    text-align: center;
    color: var(--text-muted);
    margin-top: 50px;
}

.task-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.2s;
}
.task-card:hover { border-color: var(--primary-glow); }

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.task-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.task-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.task-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-word;
}

.task-image {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
    border-radius: 8px;
    margin-top: 10px;
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: transform 0.2s;
}

.task-image:hover {
    transform: scale(1.02);
}

.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
}

.status-dropdown {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: 1px solid var(--glass-border);
    padding: 5px 10px;
    border-radius: 6px;
    outline: none;
    font-size: 0.9rem;
    cursor: pointer;
}

.status-dropdown:focus { border-color: var(--primary); }

.task-actions {
    display: flex;
    gap: 8px;
}

.btn-task-action {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s;
}
.btn-task-action:hover { color: #fff; }
.btn-task-delete:hover { color: #ef233c; }

/* Modal classes */
.todo-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.todo-modal.active { display: flex; animation: fadeIn 0.2s ease; }
.todo-modal-content {
    background: var(--bg-dark);
    padding: 30px;
    border-radius: 12px;
    width: 100%; max-width: 450px;
    border: 1px solid var(--primary-glow);
}
.todo-modal-content h3 {
    margin-bottom: 20px;
    color: var(--primary);
}
.todo-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}