/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.9375rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.35);
}

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

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

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
}

/* Inputs */
input,
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

/* Auth View */
.auth-container {
    max-width: 400px;
    width: 90%;
    margin: auto;
    text-align: center;
    padding: 2.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
}

.auth-container h1 {
    margin-bottom: 0.5rem;
}

.auth-container p {
    margin-bottom: 2rem;
}

.auth-container .input-group {
    margin-bottom: 1.5rem;
}

.auth-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Dashboard Layout */
.app-header {
    height: 64px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--glass-bg);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

.app-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.sidebar {
    width: 240px;
    padding: 1.5rem;
    border-right: 1px solid var(--border-color);
    background-color: rgba(15, 23, 42, 0.5);
}

.nav-item {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: rgba(139, 92, 246, 0.1);
    color: var(--accent-primary);
    font-weight: 500;
}

.content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
}

.toolbar input {
    max-width: 300px;
}

/* Items Grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    padding-bottom: 2rem;
}

.vault-item-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.vault-item-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--glass-shadow);
    border-color: var(--accent-primary);
}

.item-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--bg-color), var(--bg-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    border: 1px solid var(--border-color);
}

.item-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.item-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    border: 1px solid var(--border-color);
    box-shadow: var(--glass-shadow);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.password-input-wrapper {
    position: relative;
    display: flex;
}

.password-input-wrapper input {
    padding-right: 80px;
}

#generate-password-btn {
    position: absolute;
    right: 44px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
}

#generate-password-btn:hover {
    color: var(--text-primary);
}

.toggle-visibility {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
}

.toggle-visibility:hover {
    color: var(--text-primary);
}

/* Funny Warning */
.funny-warning {
    color: #ef4444 !important;
    /* Red-500 force */
    font-size: 1.15rem;
    /* Larger */
    font-weight: 700;
    margin-top: 1.5rem;
    line-height: 1.5;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    display: block;
}

/* Responsive Design */
@media (max-width: 1024px) {

    /* Layout Adjustments */
    .app-main {
        display: block;
        /* Remove flex to allow normal flow */
        height: auto;
        min-height: calc(100vh - 56px);
        /* Header height adjustment */
    }

    /* Bottom Navigation Bar */
    .sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 64px;
        /* Fixed height for touch targets */
        background-color: var(--bg-secondary);
        border-right: none;
        border-top: 1px solid var(--border-color);
        padding: 0;
        z-index: 50;
        /* Ensure on top */
        display: flex;
        align-items: center;
        box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .sidebar nav {
        display: flex;
        width: 100%;
        height: 100%;
        justify-content: space-around;
        align-items: center;
        padding: 0;
    }

    .nav-item {
        width: auto;
        margin: 0;
        flex: 1;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 0;
        text-align: center;
        font-size: 0.9rem;
        padding: 0;
    }

    .nav-item:hover {
        background-color: transparent;
    }

    .nav-item.active {
        box-shadow: inset 0 -3px 0 0 var(--accent-primary);
        background-color: rgba(139, 92, 246, 0.05);
        color: var(--accent-primary);
    }

    /* Content Area */
    .content-area {
        padding: 1rem;
        padding-bottom: 90px;
        /* Space for bottom nav */
        height: auto;
        overflow-y: visible;
        /* Let body scroll */
    }

    /* Header & Toolbar */
    .app-header {
        padding: 0 1rem;
        height: 56px;
    }

    .logo {
        font-size: 1.1rem;
    }

    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }

    .toolbar {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .toolbar input {
        max-width: 100%;
        width: 100%;
    }

    .toolbar .btn {
        width: 100%;
        justify-content: center;
    }

    /* Grid & Cards */
    .items-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .vault-item-card {
        padding: 1rem;
    }

    /* Modals */
    .auth-container {
        width: 90%;
        padding: 1.5rem;
        margin-top: 2rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.25rem;
        max-height: 85vh;
    }

    .modal-actions {
        flex-direction: row;
        gap: 0.75rem;
    }

    .modal-actions .btn {
        flex: 1;
    }

    .row {
        gap: 0.75rem;
    }
}