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

body {
    background: #111;
    color: #eee;
    font-family: Arial, sans-serif;
}

/* -----------------------------------------------------------
   GRID (4×3 Layout)
----------------------------------------------------------- */
.link-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
    padding: 20px 30px;
}

/* -----------------------------------------------------------
   LEERE KARTEN (Dropzones)
----------------------------------------------------------- */
.empty-card {
    height: 240px;
    border: 3px dashed #444;
    background: rgba(255,255,255,0.03);
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: 0.2s;
}

.empty-card:hover {
    background: rgba(255,255,255,0.07);
    border-color: #666;
}

.empty-add-btn {
    background: rgba(198, 40, 40, 0.35);
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid rgba(198, 40, 40, 0.5);
    cursor: pointer;
    transition: 0.2s;
}

.empty-add-btn:hover {
    background: rgba(198, 40, 40, 0.55);
    transform: scale(1.05);
}

.empty-card.drag-over {
    border-color: #c62828;
    background: rgba(198,40,40,0.25);
}

/* -----------------------------------------------------------
   BESETZTE KARTEN
----------------------------------------------------------- */
.link-card {
    min-height: 230px;
    background: #1d1d1d;
    border-radius: 16px;
    padding: 15px;
    border: 2px solid #333;
    display: flex;
    flex-direction: column;
    transition: 0.15s;
}

.link-card:hover {
    transform: scale(1.01);
}

/* -----------------------------------------------------------
   THUMBNAIL
----------------------------------------------------------- */
.thumb img,
.thumb-placeholder {
    width: 100%;
    height: 150px;
    object-fit: contain;
    border-radius: 12px;
}

.thumb-placeholder {
    background: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #999;
}

/* -----------------------------------------------------------
   INFO
----------------------------------------------------------- */
.info {
    margin-top: 8px;
    text-align: center;
}

.info h3 {
    font-size: 1rem;
    margin-bottom: 6px;
}

/* -----------------------------------------------------------
   ACTION BUTTONS
----------------------------------------------------------- */
.card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.card-actions button {
    flex: 1;
    padding: 6px 0;
    border-radius: 8px;
    border: none;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.edit-btn {
    background: #1e88e5;
    color: #fff;
}

.edit-btn:hover {
    background: #0d47a1;
}

.delete-btn {
    background: #c62828;
    color: #fff;
}

.delete-btn:hover {
    background: #8e0000;
}

/* -----------------------------------------------------------
   DRAG HANDLE (einzige draggable Komponente!)
----------------------------------------------------------- */
.drag-handle {
    width: 42px;
    height: 38px;
    background: #2c2c2c;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    color: #bbb;
    cursor: grab;
    user-select: none;
    transition: 0.15s;
}

.drag-handle:hover {
    background: #3a3a3a;
    color: #fff;
}

.drag-handle:active {
    cursor: grabbing;
}

/* -----------------------------------------------------------
   MODALS
----------------------------------------------------------- */
.modal-bg {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 2000;
}

.modal {
    display: none;
    position: fixed;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    width: 420px;
    background: #1b1b1b;
    padding: 28px;
    border-radius: 12px;
    z-index: 2100;
    border: 2px solid #333;
}

.small-modal {
    width: 360px;
}

.modal h2,
.modal h3 {
    margin-bottom: 18px;
}

/* Inputs */
.input-group {
    margin-bottom: 16px;
}

.input-icon {
    position: relative;
}

.input-icon input {
    width: 100%;
    padding: 10px 36px;
    background: #222;
    border: 2px solid #333;
    color: white;
    border-radius: 8px;
}

.input-icon .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
}

/* File upload */
.file-upload {
    background: #333;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    position: relative;
}

.file-upload input[type=file] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Preview */
.preview {
    width: 100%;
    margin-top: 10px;
    border-radius: 8px;
}

/* Modal Buttons */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.cancel {
    background: #444;
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    color: white;
}

.cancel:hover {
    background: #555;
}

.save,
.modal-actions .delete-btn {
    background: #d32f2f;
    padding: 10px 18px;
    border-radius: 8px;
    border: none;
    color: white;
}

.save:hover,
.modal-actions .delete-btn:hover {
    background: #a30000;
}

/* -----------------------------------------------------------
   FLASH MESSAGES
----------------------------------------------------------- */
.flash-overlay {
    position: fixed;
    top: 14%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
}

.flash-message {
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    animation: fadeOut 3s forwards ease-out;
}

.flash-message.success {
    background: rgba(46,125,50,0.95);
}

.flash-message.error {
    background: rgba(198,40,40,0.95);
}

@keyframes fadeOut {
    0% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* -----------------------------------------------------------
   NAVBAR
----------------------------------------------------------- */
.navbar {
    height: 50px;
    background: #1c1c1c;
    border-bottom: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-left {
    font-size: 1.1rem;
    font-weight: 600;
}

.nav-center {
    flex: 1;
    text-align: center;
    font-size: 1.4rem;
    font-weight: bold;
}

.nav-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    position: relative;

    min-width: 220px;   /* genug Platz für Username + Dropdown */
    padding-right: 10px; /* leichter Abstand vom Rand */
}


.user-menu {
    cursor: pointer;
    padding: 6px 10px;
    background: #2a2a2a;
    border-radius: 8px;
    display: flex;
    gap: 6px;
}

.user-menu:hover {
    background: #3a3a3a;
}

.user-dropdown {
    position: absolute;
    right: 0;
    top: 46px;
    background: #1e1e1e;
    border-radius: 8px;
    display: none;
    flex-direction: column;
}

.user-dropdown a {
    padding: 10px 12px;
    text-decoration: none;
    color: #ddd;
}

.user-dropdown a:hover {
    background: #333;
}

/* Dashboard: leere Slots unsichtbar */
.dashboard-empty {
    height: 180px;
    border-radius: 16px;
}

/* Dashboard-Karten nicht verschiebbar */
.dashboard-card {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    background: #1d1d1d;
    border-radius: 16px;
    display: block;
    padding: 15px;
    border: 2px solid #333;
    transition: 0.15s;
}

.dashboard-card:hover {
    transform: scale(1.01);
    border-color: #666;
}

/* Dashboard: Grid kompakter (passt komplett auf iPad / Browser) */
.dashboard-grid {
    padding-top: 10px;
    margin-top: 0;
}

/* Dashboard ignoriert Dropzone-Styling */
.dashboard-grid .empty-card,
.dashboard-grid .droppable {
    border: none !important;
    background: transparent !important;
}

/* ---------------------------
   LOGIN PAGE
--------------------------- */

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100vh - 60px); /* wegen Navbar */
    padding: 20px;
}

.login-card {
    background: #1b1b1b;
    padding: 40px 32px;
    border-radius: 14px;
    width: 100%;
    max-width: 380px;
    border: 2px solid #333;
    box-shadow: 0 0 18px rgba(0,0,0,0.5);
}

.login-card h2 {
    margin-bottom: 24px;
    font-size: 1.8rem;
    text-align: center;
    color: #fff;
}

.login-btn {
    width: 100%;
    margin-top: 10px;
    padding: 12px 18px;
    background: #d32f2f;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.15s;
}

.login-btn:hover {
    background: #a52121;
}

/* Input Icons identisch wie Admin */
.input-group {
    margin-bottom: 18px;
}

.input-group label {
    margin-bottom: 8px;
    display: block;
    color: #ccc;
}

.input-icon {
    position: relative;
}

.input-icon .icon {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
}

.input-icon input {
    width: 100%;
    padding: 12px 12px 12px 38px;
    background: #222;
    border: 2px solid #333;
    color: #fff;
    border-radius: 8px;
}

.checkbox-group {
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    cursor: pointer;
}
.checkbox-label input {
    transform: scale(1.2);
}