/* === Page Loading === */
html, body {
    background: #121212;
    color: #ffffff;
    transition: opacity 0.1s;
}

/* Add a fade transition to the body */
body.fade-out {
    opacity: 0;
}

/* Page loading indicator */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 18, 18, 0.9);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.1s, visibility 0.1s;
}

#page-loader.active {
    opacity: 1;
    visibility: visible;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #03dac6;
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* === Grundlayout & Farben === */
body {
    font-family: 'Segoe UI', sans-serif;
    background: #121212;
    color: #ffffff;
    margin: 0;
    padding: 0;
}

/* === Container für Formulare & Inhalte === */
.container {
    width: 100%;
    max-width: 480px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: #1e1e1e;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* === Logo containers === */
.logo-container {
    text-align: center;
    margin: 2rem 0 1rem 0;
}
.logo-container img {
    max-width: 200px;
    height: auto;
}
.logo-sidebar {
    padding: 0.5rem;
}
.logo-sidebar img {
    max-width: 20px;
    height: auto;
}


/* === Navigation === */
.navbar {
    background: #1e1e1e;
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    border-bottom: 1px solid #444;
}
.nav-btn {
    background: #2c2c2c;
    color: #03dac6;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.2s ease;
}
.nav-btn:hover {
    background: #03dac6;
    color: #000;
}
.nav-user {
    font-weight: bold;
    color: #ffffff;
    margin-right: 1rem;
}
.logout {
    margin-left: auto;
}

/* === Formularelemente === */
input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background-color: #2c2c2c;
    color: #fff;
    border: 1px solid #444;
    border-radius: 6px;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #03dac6;
}
input[type="checkbox"] {
    width: auto;
}

/* === Buttons === */
button {
    padding: 0.7rem 1.4rem;
    background-color: #03dac6;
    color: #000;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}
button:hover {
    background-color: #00c4b4;
}
button.danger {
    background-color: #e74c3c;
    color: white;
    border: none;
}

/* === Links & Text === */
a {
    color: #03dac6;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
h1, h2, h3 {
    margin-top: 0;
}
label {
    display: block;
    margin-bottom: 0.4rem;
}

/* === Fehlermeldungen === */
.error {
    background: #ff6f61;
    color: #000;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    font-weight: bold;
}

/* === Tabellen === */
table {
    background-color: #1e1e1e;
    border-collapse: collapse;
    width: 100%;
}
th, td {
    padding: 0.8rem;
    border-bottom: 1px solid #444;
}
th {
    background-color: #2a2a2a;
    text-align: left;
}

/* === Modale Bestätigungen === */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}
.modal.hidden {
    display: none;
}
.modal-content {
    background-color: #1e1e1e;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}
.modal-content button {
    margin: 0.5rem;
    padding: 0.5rem 1rem;
}

.group-transfer {
    text-align: left;
    margin: 1rem 0;
    padding: 0.5rem;
    border: 1px solid #444;
    border-radius: 4px;
}

.warning { color: #ff6f61; font-weight: bold; }

.admin-panel-link {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #03dac6;
    color: #000;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-weight: bold;
    text-decoration: none;
    z-index: 1000;
}
.admin-panel-link:hover {
    background: #00c4b4;
}

/* === Vault Layout (3-Spalten-Modus) === */
.vault-layout {
    display: flex;
    height: 100vh;
    background: #222;
    color: #eee;
}

/* Spalte 1: Vault-Gruppen */
.vault-group-subbtn.active {
    background-color: #e0e0e0;
    font-weight: bold;
}
.sidebar-left hr {
    border: none;
    border-top: 1px solid #ccc;
    margin: 10px 0;
}

.sidebar-left {
    width: 220px;
    background: #1d1d1d;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}
.vault-groups {
    list-style: none;
    padding: 0;
    margin: 0;
}
.vault-group-btn {
    display: block;
    padding: 0.6rem 1rem;
    margin-bottom: 0.3rem;
    background: #333;
    color: #fff;
    border-radius: 4px;
}
.vault-group-btn:hover,
.vault-group-btn.active {
    background: #00e6b8;
    color: #000;
}

/* Spalte 2: Einträge */
.middle-list {
    width: 250px;
    background: #2a2a2a;
    padding: 1rem;
    /* overflow-y: auto; */
}
.vault-entry-btn {
    display: block;
    padding: 0.6rem 1rem;
    margin-bottom: 0.3rem;
    background: #444;
    color: #eee;
    border-radius: 4px;
}
.vault-entry-btn:hover,
.vault-entry-btn.active {
    background: #00bbaa;
    color: #000;
}

/* Spalte 3: Detailansicht */
.details-right {
    flex: 1;
    padding: 1rem 2rem;
    overflow-y: auto;
    background: #2f2f2f;
}
.details-right p {
    margin: 0.5rem 0;
}
.password-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.password-toggle input {
    flex: 0.5;
}

/* === Footer / Bottom-Actions === */
.vault-footer,
.bottom-actions {
    padding: 1rem;
    
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}
.bottom-actions {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 220px;
    justify-content: flex-end;
}
.bottom-actions .btn-new {
    background: #00e6b8;
    color: #000;
    padding: 0.4rem 1rem;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
}

/* === Sidebar-Footer mit User & Logout === */
.sidebar-footer {
    position: fixed;
    align-items: center;
    font-size: 0.9rem;
    padding-top: 1rem;
    bottom: 1rem;
}
.sidebar-footer .logout {
    background: #03dac6;
    color: #000;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-weight: bold;
    margin-right: 1rem;
    display: block;

}
.sidebar-footer .profile {
    margin-bottom: 0.5rem;
    display: block;

}

/* === Sonstige === */
.vault-detail pre {
    white-space: pre-wrap;
    word-wrap: break-word;
}
.toast {
    background: #333;
    color: #03dac6;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 6px;
    font-weight: bold;
    text-align: center;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
    position: relative;
    z-index: 100;
}

/* Toast variants for success and error */
.toast.success {
    color: #2ecc71;
}

.toast.error {
    color: #e74c3c;
}

/* Fixed toast position (modal-like) */
.toast-fixed {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    max-width: 90%;
    width: 400px;
    z-index: 1000;
}
.btn-small {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    margin-left: 0.3rem;
    background: #922;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}
.sidebar-left .vault-group-subbtn {
    display: block;
    padding: 0.3rem 1rem;
    margin-left: 1.2rem;
    border-left: 3px solid transparent;
    transition: all 0.2s ease-in-out;
}

.sidebar-left .vault-group-subbtn.active {
    background: #2c2c2c;
    border-left: 3px solid #00bfff;
    font-weight: bold;
}

.sidebar-left h3 {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #444;
}
/* Clickable copy elements */
.copy-value {
    background-color: #2c2c2c;
    padding: 0.6rem 0.8rem;
    border-radius: 4px;
    margin-top: 0.3rem;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    word-break: break-all;
    max-width: 500px;
}

.copy-value:hover {
    background-color: #3c3c3c;
}

.copy-value::after {
    content: "📋";
    position: absolute;
    right: 10px;
    opacity: 0.5;
    font-size: 0.9rem;
}

.copy-value:hover::after {
    opacity: 1;
}

.copy-value.copied {
    background-color: rgba(3, 218, 198, 0.2);
}

/* Password specific styling */
.password-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.password-field {
    margin: 0.8rem 0;
}

.copy-value.password {
    flex: 1;
}

.toggle-btn {
    background: transparent;
    color: #03dac6;
    border: 1px solid #444;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.toggle-btn:hover {
    background-color: #3c3c3c;
}

/* Toast notification */
.copy-toast {
    position: absolute;
    background-color: #323232;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    font-size: 0.9rem;
    pointer-events: none;
}

.copy-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.copy-toast.error {
    background-color: #cf6679;
}

.share-link {
            display: inline-block;
            margin-top: 1rem;
            padding: 0.4rem 0.8rem;
            background-color: #3498db;
            color: #fff;
            border-radius: 4px;
            text-decoration: none;
        }

        .share-link:hover {
            background-color: #2980b9;
            text-decoration: none;
        }

        .shared-entries-section {
            margin-top: 2rem;
            padding-top: 1rem;
            border-top: 1px solid #444;
        }

        .shared-entries-list {
            margin: 1rem 0;
        }

        .shared-entry {
            background-color: #2c2c2c;
            padding: 0.8rem;
            margin-bottom: 0.8rem;
            border-radius: 6px;
            border-left: 3px solid #3498db;
        }

        .shared-actions {
            margin-top: 0.5rem;
            display: flex;
            gap: 0.5rem;
        }

        .manage-shares-link {
            margin-top: 1rem;
            text-align: right;
        }

        /* For the decrypt error message */
        .decrypt-error {
            background-color: rgba(231, 76, 60, 0.2);
            padding: 0.5rem;
            border-radius: 4px;
            color: #e74c3c;
            font-size: 0.9rem;
        }

        /* Notification badge for pending shares */
        .notification-badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background-color: #e74c3c;
            color: white;
            border-radius: 50%;
            min-width: 18px;
            height: 18px;
            font-size: 11px;
            margin-left: 5px;
            padding: 0 2px;
        }

.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #e74c3c;
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    margin-left: 5px;
    padding: 0 2px;
}

.share-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.4rem 0.8rem;
    background-color: #3498db;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
}

.share-link:hover {
    background-color: #2980b9;
    text-decoration: none;
}

.shared-with-info {
    margin-top: 1rem;
    padding: 0.8rem;
    background-color: rgba(52, 152, 219, 0.1);
    border-left: 3px solid #3498db;
    border-radius: 4px;
}

.shared-with-info ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.shared-with-info li {
    margin-bottom: 0.3rem;
}

.edit-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    text-decoration: none;
    display: inline-block;
    margin-top: 1rem;
    padding: 0.4rem 0.8rem;
    background-color: #666;
    color: #fff;
    border-radius: 4px;
}

.nav-toggle {
    display: none;
}

/* Mobile-first responsive design */
@media screen and (max-width: 1024px) {
    .vault-layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    
    .sidebar-left {
        width: 100%;
        order: 1;
        padding-bottom: 60px; /* Space for bottom actions */
    }
    
    .middle-list {
        width: 100%;
        order: 2;
        max-height: 300px;
        overflow-y: auto;
    }
    
    .details-right {
        width: 100%;
        order: 3;
        margin-bottom: 80px; /* Space for bottom actions */
    }
    
    .bottom-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #1d1d1d;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
        z-index: 100;
        padding: 1rem;
    }
    
    .sidebar-footer {
        position: relative;
        display: flex;
        gap: 1rem;
        bottom: auto;
    }
    
    .admin-panel-link {
        position: relative;
        top: auto;
        right: auto;
        display: inline-block;
        margin: 1rem 0;
    }
    
    /* Toggle navigation for mobile */
    .nav-toggle {
        display: block;
        background: #03dac6;
        color: #000;
        padding: 0.5rem;
        border-radius: 4px;
        text-align: center;
        font-weight: bold;
        margin: 0.5rem 0;
        cursor: pointer;
    }
    
    .mobile-hide {
        display: none;
    }
    
    /* Adjust vault groups display */
    .vault-group-btn, .vault-group-subbtn {
        padding: 0.8rem 1rem;
        margin-bottom: 0.5rem;
    }
}

/* Special styles for the smallest screens */
@media screen and (max-width: 480px) {
    .password-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toggle-btn {
        margin-top: 0.5rem;
        width: 100%;
    }
    
    .copy-toast {
        left: 50% !important;
        transform: translateX(-50%) translateY(10px);
        text-align: center;
        width: 80%;
        max-width: 300px;
    }
    
    .copy-toast.visible {
        transform: translateX(-50%) translateY(0);
    }
}

